C: What will be the output of the following program?
What will be the output of the following program?
main( )
{
printf ( "%c", "abcdefgh"[ 3 ] ) ;
}
The above program prints the character 'd' on the screen. This is because the string "abcdefgh" gives the base address of the same string. Hence, "abcdefgh"[3] is equivalent to * ( "abcdefgh" + 3 ), i.e. , the fourth character in the string which is 'd'.




Comments
Log in or create a user account to comment.