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

hi , please send me NIC written test papers to sbabavalli@gmail.com

0 Answers   NIC,


What is a method in c?

0 Answers  


find out largest elemant of diagonalmatrix

0 Answers  


Write a program to generate the first n terms in the series --- 9,11,20,31,...,82

1 Answers   Cognizant,


Is calloc better than malloc?

0 Answers  






What is else if ladder?

0 Answers  


Why is c not oop?

0 Answers  


write a program to print the consecutive repeated character from the given string... input string is : hhhhjkutskkkkkggggj output should be like this: hhhhkkkkkgggg anyone help me...

0 Answers  


What is the code in while loop that returns the output of given code?

0 Answers  


can we have joblib in a proc ?

0 Answers  


how can f be used for both float and double arguments in printf? Are not they different types?

0 Answers  


what is available in C language but not in C++?

10 Answers   CTS, TCS,


Categories