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 .

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why malloc is faster than calloc?

814


Can 'this' pointer by used in the constructor?

827


How can I swap two values without using a temporary?

844


What are loops c?

811


What are the 4 types of functions?

804


Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?

809


What are operators in c?

790


How many levels deep can include files be nested?

878


A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none

965


Explain the use of #pragma exit?

918


What do you mean by recursion in c?

863


Function calling procedures? and their differences? Why should one go for Call by Reference?

845


to find the closest pair

2072


What is the difference between c &c++?

851


how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software

3055