int main()
{
int x=10;
printf("x=%d, count of earlier print=%d",
x,printf("x=%d, y=%d",x,--x));
getch();
}
==================================================
returns error>> ld returned 1 exit status
===================================================
Does it have something to do with printf() inside another
printf().
Answer / kurt s
The code example is horrendous. But the answer:
No, it doesn't have to deal with the nested printf statements. The printed statement would look something like this:
x=9, y=9x=9, count of earlier print=8
it places the first printf's arguments on the stack, which includes another call to printf, which is placed on top. The variable x gets predecremented, so when the nested printf starts to print, x will be 9. Before the outer printf can be called, the inner printf needs to return, and printf returns an int equal to the length of the outputted string, which is "x=9, y=9", a string of length 8. Note that this is still sent to STDOUT, printing to the screen.
The outer printf call looks like this now:
printf("x=%d, count of earlier print=%d", 9, 8);
Which prints "x=9, count of earlier print=8" to STDOUT, right after the inner printf's output, giving the string mentioned toward the top of this answer.
ld returned 1 exit status usually means there are unresolved symbols.
| Is This Answer Correct ? | 1 Yes | 0 No |
What is "far" and "near" pointers in "c"...?
main() { int i=5; printf("%d%d%d%d%d%d",i++,i--,++i,--i,i); }
main() { int i=-1; -i; printf("i = %d, -i = %d \n",i,-i); }
why array index always strats wuth zero?
plz send me all data structure related programs
write a c program to Create employee record by taking details like name, employee id, address and phone number. While taking the phone number, take either landline or mobile number. Ensure that the phone numbers of the employee are unique. Also display all the details
#include<stdio.h> main() { register i=5; char j[]= "hello"; printf("%s %d",j,i); }
write a program to Insert in a sorted list
main() { int i; printf("%d",scanf("%d",&i)); // value 10 is given as input here }
main() { int x=5; clrscr(); for(;x<= 0;x--) { printf("x=%d ", x--); } } a. 5, 3, 1 b. 5, 2, 1, c. 5, 3, 1, -1, 3 d. –3, -1, 1, 3, 5
Is the following code legal? struct a { int x; struct a b; }
main() { int i=400,j=300; printf("%d..%d"); }