C - Interview Questions: Q1.Define The Scope of Static Variables
C - Interview Questions: Q1.Define The Scope of Static Variables
C INTERVIEW QUESTIONS
If the value of number is 5, the second statement in the above example results 0 (zero) and stored in the variable number.
C INTERVIEW QUESTIONS
Ex: struct employee { int empid; char name[20]; float salary; }; .. .. struct employee Catherina;
Q20.
Explain function prototype.
The basic definition of a function is known as function prototype. The signature of the function is same that of a normal function, except instead of containing code, it always ends with semicolon. When the compiler makes a single pass over each and every file that is compiled. If a function call is encountered by the compiler, which is not yet been defined, the compiler throws an error. One of the solution for the above is to restructure the program, in which all the functions appear only before they are called in another function. Another solution is writing the function prototypes at the beginning of the file, which ensures the C compiler to read and process the function definitions, before there is a change of calling the function. If prototypes are declared, it is convenient and comfortable for the developer to write the code of those functions which are just the needed ones.
Q24. The following are the differences between strcpy() and memcpy():
- memcpy() copies specific number of bytes from source to destinatio in RAM, where as strcpy() copies a constant / string into another string. - memcpy() works on fixed length of arbitrary data, where as strcpy() works on null-terminated strings and it has no length limitations. - memcpy() is used to copy the exact amount of data, whereas strcpy() is used of copy variable-length null terminated strings.
Q26.