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

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -