when i declare as:
void main()
{
clrscr();
int a=10;
printf("%d",a)
}
my problem that why generate a error in above programs.
please tell me answer seriously .

Answers were Sorted based on User's Feedback



when i declare as: void main() { clrscr(); int a=10; printf("%d",a) } my problem t..

Answer / swaroop

clrscr()
should be after the declaration of variables

Is This Answer Correct ?    14 Yes 1 No

when i declare as: void main() { clrscr(); int a=10; printf("%d",a) } my problem t..

Answer / pushpendra chauhan

the clear screen function clrscr() is not allowed before declaration of the variables in c....but if you will save your
program with .cpp extension then it will work ....bcoz it is allowed in c++.and you also dint put semicolon ; after printf statement...

Is This Answer Correct ?    7 Yes 2 No

when i declare as: void main() { clrscr(); int a=10; printf("%d",a) } my problem t..

Answer / sandhiya.g

declaration should made before the clear screen statement

Is This Answer Correct ?    6 Yes 2 No

when i declare as: void main() { clrscr(); int a=10; printf("%d",a) } my problem t..

Answer / khurshid alam

sorry brother your simple mistake following this

printf("%d",a); // here semicolon(;) must be

now run your program

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

write a program to find out prime number using sieve case?

0 Answers   HCL,


write a C program to print the program itself ?!

16 Answers   TCS,


Suggesting that there can be 62 seconds in a minute?

0 Answers  


Write a program to find minimum between three no.s whithout using comparison operator.

4 Answers   IBM,


What will be the result of the following program? main() { char p[]="String"; int x=0; if(p=="String") { printf("Pass 1"); if(p[sizeof(p)-2]=='g') printf("Pass 2"); else printf("Fail 2"); } else { printf("Fail 1"); if(p[sizeof(p)-2]=='g') printf("Pass 2"); else printf("Fail 2"); } } a) Pass 1, Pass 2 b) Fail 1, Fail 2 c) Pass 1, Fail 2 d) Fail 1, Pass 2 e) syntax error during compilation

10 Answers   IBM,






please send me papers for Dy. manager IT , PNB. it would be a great help for me.

0 Answers  


Why is #define used?

0 Answers  


what is calloc and malloc?

2 Answers  


Tell us the use of fflush() function in c language?

0 Answers  


What does return 1 means in c?

0 Answers  


What is a global variable in c?

0 Answers  


what is the output of printf("%d",(scanf("%d",10));

10 Answers  


Categories