© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu

C and C++ Interview Questions

9. What is the difference between #include and #include “file”?

Ans:

When we use #include then the compiler searches for the file at the default address only but when we use #include ”file” then it searches for the whole.

Ex - 1:
#define max value 10
void main()
{
    int a=60;
    if(a/max value==6)
         printf("equal");
    else
         printf("not equal");
}
What will be output if you compile and execute the above code?
(a) equal
(b) not equal
(c) Run time error
(d) Compiler error

Ex - 2:  
#define num int long
void main()
{
    num a=0;
 
    printf("%d,%d,%d",a++,sizeof a++,sizeof(a++));
 
}

What will be output if you compile and execute the above code?
(a)3 2 4
(b)0 0 4
(c)0 4 4
(d)Compiler error

Ex - 3:  
#define short int long
void main()
{
  
    printf("%d",sizeof(short));
   
}

What will be output if you compile and execute the above code?

(a)2
(b)4
(c)8
(d)Compiler error


SLogix Student Projects
bottom