-
}
">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".
-
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...
-
-
-
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 procedure in memory after running the c program ?
I mean generally after execution of c program .c,.doc,.exe,.bak files are created,so how these files are allocated in the memory stack?
-
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.
-
-
-
-
-
Pascal Triangle
What is the C program for Pascal Triangle 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 5 1
-
Can static variables be declared in a header file?
You can’t declare a static variable without defining it as well (this is because the storage class modifiers static and extern are mutually exclusive). A static variable can be defined in a header file, but this would cause each source file that included the header file to have its own private copy of the variable, which is probably not what was intended.
-
-
What is a macro, and how do you use it?
A macro is a preprocessor directive that provides a mechanism for token replacement in your source code. Macros are created by using the #define statement. Here is an example of a macro: Macros can also utilize special operators such as the stringizing operator (#) and the concatenation operator (##).The stringizing operator can be used to convert macro parameters to quoted strings, as in the...
-
-
C Interview Questions
Ans