Monday, October 6, 2008

What will be printed when the sample code below is executed?

char *buffer = "0123456789";
char *ptr = buffer;
ptr += 5;
printf( "%s\n", ptr );
printf( "%s\n", buffer );

Choice a: 0123456789
56789
Choice b: 5123456789
5123456789
Choice c: 56789
56789
Choice d: 0123456789
0123456789
Choice e: 56789
0123456789

No comments: