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().

Answers were Sorted based on User's Feedback



int main() { int x=10; printf("x=%d, count of earlier print=%d", ..

Answer / aditya lele

It does not return an error .
the output would be
x=9, y=9x=9, count of earlier print=8

HINT: try and understand the way printf evaluation works (right to left or left to right), also keep in mind when printf is called and what argument values are passed and when exactly is the data written to STDOUT

Is This Answer Correct ?    3 Yes 0 No

int main() { int x=10; printf("x=%d, count of earlier print=%d", ..

Answer / aditya lele

By the way the error that you are talking about is because
of the fact that your function has an integer return type
and you are not returning anything.
add a

return 0;

at the end before you close the main()

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More C Code Interview Questions

Write a c program to search an element in an array using recursion

1 Answers   Wipro,


main() { int i=5; printf(ā€œ%dā€,i=++i ==6); }

1 Answers  


There are 21 people in a room. They have to form groups of 3 people each. How many combinations are possible? Write a C program to print the same.

1 Answers   TCS,


Find the largest number in a binary tree

7 Answers   Infosys,


main() { extern int i; i=20; printf("%d",sizeof(i)); }

2 Answers  






main() { char *a = "Hello "; char *b = "World"; clrscr(); printf("%s", strcat(a,b)); } a. Hello b. Hello World c. HelloWorld d. None of the above

3 Answers   HCL,


C statement to copy a string without using loop and library function..

2 Answers   Persistent, TCS,


main() { char string[]="Hello World"; display(string); } void display(char *string) { printf("%s",string); }

2 Answers   Wipro,


main(){ unsigned int i; for(i=1;i>-2;i--) printf("c aptitude"); }

2 Answers  


main() { char *p; p="Hello"; printf("%c\n",*&*p); }

1 Answers  


programming in c lanugaue programm will errror error with two header file one as stdio.h and other one is conio.h

1 Answers  


void main() { char far *farther,*farthest; printf("%d..%d",sizeof(farther),sizeof(farthest)); }

2 Answers  


Categories