Thursday 2 February 2012

Variable Name Type Question

1. What will be output of the following c program ?
#include<stdio.h>
int abc=10;
int main(){
int abc=20;
printf("%d",abc);
return 0;
}
A) 10
B) 20
C) 30
D) Compilation error

Answer  : B

2. What will be output of the following c program?
#include<stdio.h>

int main(){
int main=20;
printf("%d",main);
return 0;
}
A) 80
B) 0
C) 30
D) Compilation error

Answer  :A