0
Why is the output only world
5 ответов
+ 10
Print the string "Hello world" starting from 6th character
↓
index |0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5
char |H|e| l | l|o| |w|o|r| l|d|
+ 4
printf(6+"Hello world");
Is the same as:
char* p = "Hello world";
printf( *(p+6));
You are giving printf the pointer to the beginning of the string to be displayed...
+ 3
I'm not sure but i think it prints a substring starting from the 6th index(5th in C). So it prints ' world'
0
But I want to know why ?