You are trying to change a string literal.
(您正在尝试更改字符串文字。)
char *a = "eens kijken of we deze string kunnen splitten";
String literals are immutable in C. Any attempt to change a string literal results in undefined behavior.
(字符串文字在C中是不可变的。任何更改字符串文字的尝试都会导致未定义的行为。)
From the C Standard (6.4.5 String literals)
(根据C标准(6.4.5字符串文字))
7 It is unspeci?ed whether these arrays are distinct provided their elements have the appropriate values.
(7如果这些数组的元素具有适当的值,则不确定这些数组是否不同。)
If the program attempts to modify such an array, the behavior is unde?ned. (如果程序尝试修改这样的数组,则行为未定义。)
Instead declare a character array
(而是声明一个字符数组)
char a[] = "eens kijken of we deze string kunnen splitten";
Also in this declaration
(同样在此声明中)
char *b = a[5];
there is a typo.
(有一个错字。)
Should be (应该)
char *b = &a[5];
or
(要么)
char *b = a + 5;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…