ALLInterview.com :: Home Page KalAajKal.com
 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                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
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
#include"math.h"
void main()
{
	printf("Hi everybody");
}
if <stdio.h> will be included then this program will must
compile, but as we know that when we include a header file
in "" then any system defined function find its defination
from all the directrives. So is this code of segment will
compile? If no then why?
 Question Submitted By :: Saswata Guha
I also faced this Question!!     Rank Answer Posted By  
 
  Re: #include"math.h" void main() { printf("Hi everybody"); } if <stdio.h> will be included then this program will must compile, but as we know that when we include a header file in "" then any system defined function find its defination from all the directrives. So is this code of segment will compile? If no then why?
Answer
# 1
above error will come
error C3861: 'printf': identifier not found
 
Is This Answer Correct ?    0 Yes 1 No
Siva.kumar
 
  Re: #include"math.h" void main() { printf("Hi everybody"); } if <stdio.h> will be included then this program will must compile, but as we know that when we include a header file in "" then any system defined function find its defination from all the directrives. So is this code of segment will compile? If no then why?
Answer
# 2
There is  no error in this code. If you will compile this 
code in Borland Turbo C++ compiler, then the program will 
be compiled easily and no error will be shown at that 
time.  In addition, if you want the output then include 
getch();  after the printf statment.  You will get the 
output definetly.

#include "math.h"
void main()
{
printf("Hi Everybody");
getch();
}
 
Is This Answer Correct ?    2 Yes 0 No
Er. Preeti
 
 
 

 
 
 
Other C Code Interview Questions
 
  Question Asked @ Answers
 
How to return multiple values from a function?  4
main() { int i=-1; +i; printf("i = %d, +i = %d \n",i,+i); }  1
main() { char c; int i = 456; clrscr(); c = i; printf("%d", c); } a. 456 b. -456 c. random number d. none of the above HCL1
struct aaa{ struct aaa *prev; int i; struct aaa *next; }; main() { struct aaa abc,def,ghi,jkl; int x=100; abc.i=0;abc.prev=&jkl; abc.next=&def; def.i=1;def.prev=&abc;def.next=&ghi; ghi.i=2;ghi.prev=&def; ghi.next=&jkl; jkl.i=3;jkl.prev=&ghi;jkl.next=&abc; x=abc.next->next->prev->next->i; printf("%d",x); }  1
main() { int i=5; printf("%d",++i++); }  1
# include<stdio.h> aaa() { printf("hi"); } bbb(){ printf("hello"); } ccc(){ printf("bye"); } main() { int (*ptr[3])(); ptr[0]=aaa; ptr[1]=bbb; ptr[2]=ccc; ptr[2](); }  1
void main() { char ch; for(ch=0;ch<=127;ch++) printf(“%c %d \n“, ch, ch); }  1
main() { unsigned int i=10; while(i-->=0) printf("%u ",i); }  1
struct Foo { char *pName; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); strcpy(obj->pName,"Your Name"); printf("%s", obj->pName); } a. Your Name b. compile error c. Name d. Runtime error HCL1
Find your day from your DOB? Microsoft12
Given n nodes. Find the number of different structural binary trees that can be formed using the nodes. Aricent7
char *someFun1() { char temp[ ] = “string"; return temp; } char *someFun2() { char temp[ ] = {‘s’, ‘t’,’r’,’i’,’n’,’g’}; return temp; } int main() { puts(someFun1()); puts(someFun2()); }  1
union u { union u { int i; int j; }a[10]; int b[10]; }u; main() { printf("\n%d", sizeof(u)); printf(" %d", sizeof(u.a)); // printf("%d", sizeof(u.a[4].i)); } a. 4, 4, 4 b. 40, 4, 4 c. 1, 100, 1 d. 40 400 4 HCL1
Print an integer using only putchar. Try doing it without using extra storage.  1
main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++){ printf(" %d ",*p); ++p; } }  1
Is the following code legal? struct a { int x; struct a *b; }  1
How to swap two variables, without using third variable ? HCL47
#define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); }  1
void main() { int k=ret(sizeof(float)); printf("\n here value is %d",++k); } int ret(int ret) { ret += 2.5; return(ret); }  1
main() { printf("%d, %d", sizeof('c'), sizeof(100)); } a. 2, 2 b. 2, 100 c. 4, 100 d. 4, 4 HCL3
 
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 © 2007  ALLInterview.com.  All Rights Reserved.

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