c - How can the output be explained? -


this question has answer here:

i dealing pointers in c , when run following code "l" output! why?

char *s = "hello, world!";  printf("%c", 2[s]); 

what 2[s] signify?

this prints s[2] l. it's because s[i] syntactically equal *(s + i). therefore s[2] , 2[s] both converted *(s + 2).


Comments

Popular posts from this blog

How to check data type in C++? -

javascript - Is getTimezoneOffset() stable during daylight saving transition? -

formula - R: how to pass in a reference to the variable in glm or lm? -