C Interview Questions Part 23

Q:Why C Language is platform dependent?
A:c is a Structure oriented programming language and it doesn't generate any byte code which can't be run on any operating system with this disadvantage C don't become a platform independent.

Q:How will you allocate memory to double a pointer?

A:main()
{
char *pch; **ppch;
pch = malloc(100);
if(pch == NULL)
return -1;
ppch = &pch;
}

Q:Difference between ordinary variable and pointer in C?

A:An ordinary variable is like a container it can hold any value and we can change the value of ordinary variable at time throughout the program. A pointer is a variable that stores the address of another variable

Q:How to swap two integers 1 and 32767 without using third variable?

A:Below logic can be used to swap for the required condition:
a=1;
b=32767;
a=a+b;
b=a-b;
a=a-b;

Q:Which operator is known as dummy operator in c?

A:unary + is the only dummy operator in c

Q:What is pre-processor?

A:Preprocessor directives are not the libraries which should be included while writing a program .But it is a notation used to include the libraries which are included in the header part of a program

Q:What is void pointer?
A:Void pointer is the pointer which itself is null and can not be interchanged by others.
Example:
{
int *a;
void *b;

*a=*b; //valid
a=b; //invalid
}