Monday, March 22, 2010

59

Predict the output:
int main()
{
printf(5+"sharksrini");
return 0;
}

Output:
srini
Logic:
consider a string operation.
char a[]="sharksrini";
a+1 will specifies address in which 'h' is stored .if we print a+1 ,it will print "harksrini"
a+2 will specifies address in which 'a' is stored. if we print a+2,it will print "arksrini"
likewise
a+5 will print "srini"

In this program 5+"sharksrin" will print "srini" in the same procedure above specified

0 comments:

Post a Comment