C Interview Questions And Answers
|
C FAQS
C Question
- What is a structure and a union in C?
- Define a structure for a simple name/address
record.
- What does the typedef keyword do?
- Use typedef to make a short-cut way to declare a
pointer to the nameAddr structure above. Call it addrPtr.
Declare a variable with addrPtr called address.
Assuming the variable address above, how would one refer to the city portion
of the record within a C expression?
- What is the difference between: #include <stdio.h>
and #include "stdio.h"
- What is #ifdef used for?
- How do you define a constant in C?
- Why can't you nest structure definitions?
- Can you nest function definitions?
- What is a forward reference?
- What are the following and how do they differ: int,
long, float and double?
- Define a macro called SQR which squares a number.
- Is it possible to take the square-root of a number
in C. Is there a square-root operator in C?
- Using fprintf() print a single floating point
number right-justified in a field of 20 spaces, no leading zeros, and 4
decimal places. The destination should be stderr and the variable is called
num.
- What is the difference between the & and &&
operators and the | and || operators?
- What is the difference between the -> and .
operators?"
- What is the symbol for the modulus operator?
- From the standpoint of logic, what is the
difference between the fragment:
if (next < max)
next++;
else
next = 0;
and the fragment:
next += (next < max)? (1):(-next);
What does the following fragment do?
while((d=c=getch(),d)!=EOF&&(c!='\t'||c!=' '||c!='\b')) *buff++ = ++c;
- Is C case sensitive (ie: does C differentiate
between upper and lower case letters)?
- Specify how a filestream called inFile should be
opened for random reading and writing. the file's name is in fileName.
|
|
|