Saturday, November 26, 2011

Strange are the ways of C


Have look at the following snippet, you can see 4 values that which will be printed for each iteration of the loop when you run it. Actually they all are just different ways of representing the same idea !! Try it out on www.codepad.org to see and believe !!

main()
{
char s[ ]="man";
int i;
for(i=0;s[i];i++)
printf("\n %c %c %c %c ", s[ i ] , *(s+i) , *(i+s) , i[s] );
}

No comments:

Post a Comment