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
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 |
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 |
void main() { printf(“sizeof (void *) = %d \n“, sizeof( void *)); printf(“sizeof (int *) = %d \n”, sizeof(int *)); printf(“sizeof (double *) = %d \n”, sizeof(double *)); printf(“sizeof(struct unknown *) = %d \n”, sizeof(struct unknown *)); }
void main() { char far *farther,*farthest; printf("%d..%d",sizeof(farther),sizeof(farthest)); }
main() { int i; clrscr(); printf("%d", &i)+1; scanf("%d", i)-1; } a. Runtime error. b. Runtime error. Access violation. c. Compile error. Illegal syntax d. None of the above
main( ) { void *vp; char ch = ‘g’, *cp = “goofy”; int j = 20; vp = &ch; printf(“%c”, *(char *)vp); vp = &j; printf(“%d”,*(int *)vp); vp = cp; printf(“%s”,(char *)vp + 3); }
How to return multiple values from a function?
#define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); }
4 Answers Google, HCL, Quick Heal, WTF,
Write a Program that Inputs 10 Numbers in an Array and Show the Maximum Number
char inputString[100] = {0}; To get string input from the keyboard which one of the following is better? 1) gets(inputString) 2) fgets(inputString, sizeof(inputString), fp)
main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }
Given n nodes. Find the number of different structural binary trees that can be formed using the nodes.
16 Answers Aricent, Cisco, Directi, Qualcomm,
How can you relate the function with the structure? Explain with an appropriate example.
How to swap two variables, without using third variable ?
104 Answers AB, ADP, BirlaSoft, Cisco, Cygnet Infotech, HCL, Hewitt, Honeywell, HP, IBM, Infosys, Manhattan, Microsoft, Mobius, Percept, Satyam, SofTMware, TCS, Wipro, Yamaha,