Thursday, July 9, 2009

In c language Wat is the output for this statement printf("welcome"+2);and give me the reson>?

I don't use C anymore but from the looks of it I would say that's an error. The only other option I can think is it print "lcome" because it constructed the string in memory and then added 2 to the location and sent that to printf. but really I think it will not compile.

In c language Wat is the output for this statement printf("welcome"+2);and give me the reson%26gt;?
Output: "lcome"


while adding two to the string will increase the stack pointer by two, hence while reading from the memory, It shows only "lcome" instead of "welcome".

calling cards

No comments:

Post a Comment