Thursday 9 February 2012

C program Statements


Dear Members,
        Today we will discuss about C program statements and also give you some examples....
SO FRIEND LETS START OUR LESSON
  • C program Statements:-
A program statement is a fundamental unit of any programming language. It is an instruction for the computer to do something. The set of statements of C program are written under the main() function (or any user defined function) between curly brackets i.e {     }. Typically, in C program, the library functions are called for execution in the main body of the program.
For Example:-
                    The printf() function is used to print a message or output of the program. Every statement of C program must be terminated with semicolon (;). It is called statement terminator. If statement terminator (;) is missing at the end of any statement, then the following error message will be reported by C compiler during compiling process.
Statement Missing
         C language is a case sensitive language. Each statement of C program is normally written in lowercase letters. However, variable names or user-defined function names with uppercase letters can be used in C program.
                             C program is written below to clear the computer screen and to print a message on the screen.
                                   #include<stdio.h>
                                    #include<conio.h>
            main()
{
                              clrscr();
                                                       printf("Welcome");
}

In the above program, two statements are written in the body of main() function. Each statement ends with semicolon ( ; ).

1 comment:

  1. A statement containing operators and variables in C is called an Expression. C operators connects constants in c and variables to form expressions.

    ReplyDelete