-
-
-
Is nesting of conditional operator( ? : ) possible? If no then why? If yes then write down the program to find the greatest of three number?
Yes, Nesting of conditional operator is possible .Write down the program yourself.
-
-
-
-
Main(){ char * strA; char * strB = I am OK; memcpy( strA, strB, 6);}
A) Compile errorB) I am OKC) Runtime error.D) I am OExplanation: I am OK is not within " "
-
-
-
What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
The strcpy() function is designed to work exclusively with strings. It copies each byte of the source string to the destination string and stops when the terminating null character () has been moved. On the other hand, the memcpy() function is designed to work with any type of data. Because not all data ends with a null character, you must provide the memcpy() function with the number of bytes you...
-
}
">All the programs are tested under Turbo C/C++ compilers. It is assumed that, Programs run under DOS environment, The underlying machine is an x86 system, Program is compiled using Turbo C/C++ compiler.The program output may depend on the information based on this assumptions (for example sizeof(int) == 2 may be assumed). Predict the output or error(s) for the following:i) void main(){ int const * p=5; printf("%d",++(*p));}
Answer: Compiler error: Cannot modify a constant value. Explanation: p is a pointer to a "constant integer". But we tried to change the value of the "constant integer".
-
Write the equivalent expression for x%8?
x&7 Write expressions to swap two integers without using a temporary variable?
-
-
What is the output for the following code
main{int x=90;float *ptr;ptr=(float *)&x;*ptr=50.0;printf("%d",x);printf("%f",*pf);}Though the address of i & pf are same but the value which i get when i print x is a different integer value and when *pf is printed it gives the value 50.0 .why?
-
When should the register modifier be used? Does it really help?
The register modifier hints to the compiler that the variable will be heavily used and should be kept in the CPU’s registers, if possible, so that it can be accessed faster. There are several restrictions on the use of the register modifier. First, the variable must be of a type that can be held in the CPU’s register. This usually means a single value of a size less than or equal to the size of an...
-
-
-
-
-
C Interview Questions
Ans