-
What is a null pointer?
There are times when it’s necessary to have a pointer that doesn’t point to anything. The macro NULL, defined in <stddef.h>, has a value that’s guaranteed to be different from any valid pointer. NULL is a literal zero, possibly cast to void* or char*. Some people, notably C++ programmers, prefer to use 0 rather than NULL. The null pointer is used in three ways: 1) To stop indirection in...
-
-
-
-
What is Preprocessor?
The preprocessor is used to modify your program according to the preprocessor directives in your source code. Preprocessor directives (such as #define) give the preprocessor specific instructions on how to modify your source code. The preprocessor reads in all of your include files and the source code you are compiling and creates a preprocessed version of your source code. This preprocessed version...
-
else
printf("I hate U");
}
">Iii) main(){ float me = 1.1; double you = 1.1; if(me==you)printf("I love U");else printf("I hate U");}
I hate UExplanation:For floating point numbers (float, double, long double) the values cannot be predicted exactly. Depending on the number of bytes, the precession with of the value represented varies. Float takes 4 bytes and long double takes 10 bytes. So float stores 0.9 with less precision than long double.Rule of Thumb: Never compare or at-least be cautious when using floating point numbers with...
-
> (i - (i -1)));
}
}
">Main(){ signed int bit=512, i=5; for(;i;i--) { printf("%dn", bit >> (i - (i -1))); }}
A) 512, 512, 512, 512, 512B) 256, 256, 0, 0, 0C) 512, 256, 0, 0, 0D) 256, 256, 256, 256, 256Explanation: bit's value is not changed
-
What is the purpose of realloc( )?
the function realloc(ptr,n) uses two arguments.the first argument ptr is a pointer to a block of memory for which the size is to be altered.The second argument n specifies the new size.The size may be increased or decreased.If n is greater than the old size and if sufficient space is not available subsequent to the old region, the function realloc( ) may create a new region and all the old data are...
-
-
}
void func2(int a[][10])
{
printf("Will this work?");
}
main()
{
int a[10][10];
func1(a);
func2(a);
}
">Void func1(int (*a)[10]){ printf("Ok it works");}void func2(int a[][10]){ printf("Will this work?");} main() { int a[10][10]; func1(a); func2(a);}
A) Ok it worksWill this work?B) Will this work?C) Ok it worksD) None of the above
-
-
-
-
-
-
-
-
Point out the error in the following program main() { int a=10; void f(); a=f(); printf("n%d",a); } void f() { printf("nHi"); }
The program is trying to collect the value of a "void" function into an integer variable.
-
What would be the output of the following program? main() { int y=128; const int x=y; printf("%d",x); }
A) 128B) Garbage valueC) ErrorD) 0
-
C Interview Questions
Ans