ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
   
 
Categories  >>  Code Snippets  >>  Programming Code  >>  C Code
 
 


 

 
 C Code interview questions  C Code Interview Questions
 C++ Code interview questions  C++ Code Interview Questions
 VC++ Code interview questions  VC++ Code Interview Questions
 Java Code interview questions  Java Code Interview Questions
 Dot Net Code interview questions  Dot Net Code Interview Questions
 Visual Basic Code interview questions  Visual Basic Code Interview Questions
 Programming Code AllOther interview questions  Programming Code AllOther Interview Questions
Question
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().
 Question Submitted By :: Jahuja400
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 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
# 1
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
Aditya Lele
 
  Re: 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
# 2
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
Aditya Lele
 
 
 

 
 
 
Other C Code Interview Questions
 
  Question Asked @ Answers
 
main() { unsigned char i=0; for(;i>=0;i++) ; printf("%d\n",i); }  1
main() { char *p; p="%d\n"; p++; p++; printf(p-2,300); }  1
Write a routine that prints out a 2-D array in spiral order Microsoft3
how many processes will gate created execution of -------- fork(); fork(); fork(); -------- Please Explain... Thanks in advance..! GATE8
main() { int i=4,j=7; j = j || i++ && printf("YOU CAN"); printf("%d %d", i, j); }  1
What is the problem with the following code segment? while ((fgets(receiving array,50,file_ptr)) != EOF) ;  1
main() { int k=1; printf("%d==1 is ""%s",k,k==1?"TRUE":"FALSE"); }  1
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().  2
#include<stdio.h> void fun(int); int main() { int a; a=3; fun(a); printf("\n"); return 0; } void fun(int i) { if(n>0) { fun(--n); printf("%d",n); fun(--n); } } the answer is 0 1 2 0..someone explain how the code is executed..? Wipro1
Given a list of numbers ( fixed list) Now given any other list, how can you efficiently find out if there is any element in the second list that is an element of the first list (fixed list) Disney3
How to return multiple values from a function?  7
What is the hidden bug with the following statement? assert(val++ != 0);  1
 
For more C Code Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2012  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com