Functions and Pointers in C Programming Language (Part 2)

In the event that you have gotten a handle on the idea of ‘calling’ a function you are set up for a call to in excess of one function. Think about the following program:

main( )
printf ("\n This is main Function");
clanguage( );
javaLanguage( );
htmlLanguage( );
cLanguage( )
printf("\n I am C Language");
javaLanguage( )
printf("\n I am Java language");
htmlLanguage( )
printf("\n I am HTML Language");
                 The output of the above progrm:
                     This is main Function
                    I am C Language
                   I am Java language
                  I am HTML Language

From this above program, various conclusions can be drawn about C function and we have to make sure remembers those points.

  • Any C program contains somewhere around one Function.
  • If a program contains just a single function, it must be main( ).
  • If a C program contains in excess of one function, at that point one of these functions must be main( ) function, in the fact that program execution dependably always starts with main( ).
  • There is no restriction on the number of functions that may be available in a C program.
  • Each function in a program is brought in the sequence determined by the function brings in main( ).
  • After each function has done its thing, control comes back to main( ). When main( ) comes up short on function calls, the program closes.

As we have noted before the program execution dependably always starts with main( ). With the exception of this reality, all C functions appreciate a condition of immaculate correspondence. No priority, no needs, no one is no one’s supervisor. One function can call another function it has just called yet has meanwhile left briefly with the end goal to call a third function which will at some point later consider the function that has called it. Let’s take a look below C program.

main( )
printf("\n I am main Function");
cProgram( );
printf("\n I am Heart of Programming Language");
cProgram( )
printf("\n I am Java Programming language");
javaProgram( );
printf ("\n I am World top computer programming Language");
javaProgram( )
printf("\n I am best Markup Language HTML");
htmlProgram( );
htmlProgram( )
printf ("\n I am super easy programming langauge");
            The output would look like…
                 I am main Function
                I am Java Programming language
                I am best Markup Language HTML
               I am super easy programming langauge
              I am World top computer programming Language
             I am Heart of Programming Language


main( ) function calls different functions, which thusly call still a different functions. Look carefully the manner in which control goes starting with one function then onto the next. Since the compiler dependably starts the program execution with main( ), each function in a program must be called specifically or by implication by main( ). As it were, the main( ) work drives different functions.

Summarize about Function in C program

  • C program is a gathering of at least one or more functions.
  • A function gets considered when the function name is followed by a semicolon.
  • A function is characterized when a function name is followed by a couple of braces in which at least one statements might be available.A
  • Any function can be called from some other function. Even main( ) can be called from different functions.
  • The function can be called many of times anywhere in a program as we required.
  • The request or order in which the function is characterized in a program and the order in which they get called require not really be same.
  • A function can be called from another function, yet a function can’t be characterized in another function.
  • There are essentially two kinds of functions:
    Library function Like: printf( ), scanf( ) etc
    User-defined function like: javaProgram( ), htmlLanguage( ) etc

    : As the name proposes, library functions are only ordinarily required functions assembled together and put away in, what is known as a Library. This library of functions is available on the circle and is composed for use by individuals who compose compilers for us. Quite often a compiler accompanies a library of standard functions. The strategy of calling the two kinds of functions is actually the same.

Post Author: Base Read

Leave a Reply

Your email address will not be published. Required fields are marked *