-
}
">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