Thursday, July 9, 2009

In c are c++ wat is the output for this statement printf("welcome%d",+2); give the explanation?

that prints the following:





welcome2





because %d tells it to print the first number after the comma as a decimal number. come to think of it, it might print welcome2.0, why don't you compile it and find out?

In c are c++ wat is the output for this statement printf("welcome%d",+2); give the explanation?
that statement prints





welcome and the number with increments of 2.
Reply:This prog gives error coz %d is indicating variable value, following by the quoted string. but in place of the variable and integer is passed(+2). so it wont work.. compiler error.


No comments:

Post a Comment