Debugging questions are common in C Language interviews. In this post you can find some example c interview questions related to debugging.
Find error in following
c snippet?
#include
<stdio.h>
#include
<conio.h>
int
x;
int
x=0;
int
x;
int
main(){
printf("%d",x);
getch();
return 0;
}
Answer:
No error. Global variables can have
several declarations in C. Same is true for function declarations.
Find error in following
c snippet?
#include
<stdio.h>
#include
<conio.h>
int
x;
int
x=0;
int
x;
int
x=1;
int
main(){
printf("%d",x);
getch();
return 0;
}
Answer:
Error in Line number 6. Global
variables can have several declarations in C but only one definition. Same is
true for function declarations.
You can find more such c interview question in related post mentioned below:
No comments:
Post a Comment