Saturday 23 March 2013

Common functions

The following are some of the most common and important functions in basic understanding of C programming :-

1. main():- One of the most important functions of C programming. It is a standard function which deals with the main logic of the program. Generally all the main operations which are to be done for the module are done here.The syntax of the function is as follows:

                          main()

2. scanf() :- Another important function which is used for taking inputs from the user. The syntax of the function is as follows:
       
                           scanf("%<format string>",&<variable>);

               The format string is ' % ' followed by a letter which specifies the type of variable to be used. Eg:          %c specifies character, %d specifies integer type,etc.

3. printf() :- Another important function which is used for displaying outputs on the screen. The syntax of the function is as follows:
       
                           printf("%<format string>",<variable>);

4. getch() :- This function is used to stop the program flow at a point where the user has to press a key to continue. Simply, it forces the user to input any "keyboard letter" which is not visible at that time.The syntax of the function is as follows:

                            getch();

5. clrscr() :- This function has to be activated in Turbo C. It has the function of clearing the screen for the next program to implement.The syntax of the function is as follows:

                             clrscr();


No comments:

Post a Comment