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

4.A function 'q' that accepts a pointer to a character as argument and returns a pointer to an array of integer can be declared as: A)int (*q(char*)) [] B)int *q(char*) [] C)int(*q)(char*) [] D)None of the Above

6 Answers   Accenture,


Explain the properties of union. What is the size of a union variable

0 Answers  


What are keywords c?

0 Answers  


Write a code to generate a series where the next element is the sum of last k terms.

0 Answers   Aspiring Minds,


What is linear search?

0 Answers  


will u give me old quesrion papers for aptitude for L & t info tech?

1 Answers   Hindustan, L&T,


Why the below program throughs error during compilation? #include<stdio.h> #include<conio.h> enum { ZERO, ONE, TWO, }; main() { printf("%d",&TWO); getch(); }

2 Answers  


15.what is the disadvantage of using macros? 16.what is the self-referential structure? 17.can a union be self-referenced? 18.What is a pointer? 19.What is the Lvalue and Rvalue? 20.what is the difference between these initializations? 21.Char a[]=”string”; 22.Char *p=”literal”; 23.Does *p++ increment p, or what it points to?

2 Answers   CTS,


how to find out the reverse number of a digit if it is input through the keyboard?

6 Answers  


How do I copy files?

0 Answers  


write a program to display the frequency of each element in a given array in c language

1 Answers  


What is the difference between memcpy and memmove?

0 Answers  


Categories