Some important points in C

1) In C language more than one statement can be separated by using comma into single line.

for example:-

void main()

{

clrscr();

printf(“Welcome”);

getch();

}

or

void main()

{

clrscr(), printf(“welcome”), getch();

}

or

void main(),{clrscr(),printf(“welcome”),getch();}

or

void main() { printf(“ “, getch() , printf(“Welcome”),clrscr();}



2) In C language a variable statement must be 1st statement after open curly braces ({) otherwise leads to compile time error.

For example:-

void main()

{

int a=10;

clrscr();

printf(“Value of a %d”,a);

getch();

}


Output ----- Value of a=10

void main()

{

clrscr();

int a=10;

printf(“Value of a%d=”,a);

getch();

}



Output ----- Error-Declaration is not allowed here. 





3) A C compiler prompt a warning message when a value of a variable of a variable does not use in application or program.

For example:-

void main()

{

int a=10;

clrscr();

printf(“welcome to C”);

getch();

}

Output------ Warning:-a is assigned.


welcome to C



Comments

Popular Posts