Results 1 to 6 of 6

Thread: Concept of function in C programming

  1. #1
    Join Date
    Nov 2009
    Posts
    712

    Concept of function in C programming

    Hi,

    I want your suggestion on the function of the C programming. I am aware about the basic programming of the C language. But I am quit getting confused regarding concept of the functions in the C programming.

    Is function similar to the main method? If anybody aware about the functions then please share your knowledge with me, so that it will be useful for me to understand the concept of functions.

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: Concept of function in C programming

    The block of code which has a unique name as well as reusable property is called as "Function". For your kind information functions could be called from the various places from the C program. The main use of the function is to bind the multiple statements into the single unit. and which is called from the different sentences of the program. I short it is a self contained block of the statements in the C language.

  3. #3
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Concept of function in C programming

    Hi,

    The function name must be unique in a C language Program code. The name of the functions is also Global. The use to making function global is that we are able to access functions of C language from any other C program code. Which increases the re-usability of the program code . There are various types are available in the C programming language. I don't know more about the C functions.

  4. #4
    Join Date
    May 2008
    Posts
    2,389

    Re: Concept of function in C programming

    Hi friend,

    According to my C programming knowledge there are five main types of the functions in the C programming.The advantages of the programming is depends upon the methods of using functions.

    Following are the different function type available in the C language:

    A. Function which has no arguments along with return values.
    B. Function which has arguments along with return values.
    C. Function which has no arguments and no return values.
    D. Function which has arguments along with no return values.
    E. Function which has return multiple values.

  5. #5
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Concept of function in C programming

    Hi,

    Function is the sub-program which is called by the main() method.

    Following program will explain you the exact use of the Functions in the C programming:

    #include<conio.h>
    #include<stdio.h>

    void add(int a, int b)
    {

    int r;
    r = a+b;
    printf("Sum of %d and %d is %d.\n\n",a,b,r);
    }
    void main()
    {
    clrscr();
    add(50,85);
    add(73,69);
    add(52,121);
    getch();
    }

  6. #6
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Concept of function in C programming

    Following is the best example of "Function with argument and with return type " of the C programming and which is definitely useful for you:
    #include<stdio.h>
    #include<conio.h>

    int sum(int p, int q)

    {

    int z;
    z = p+q;
    return(z);

    }

    void main()

    {

    int t;
    clrscr();
    t = sum(572,121);

    printf("Sum:%d.\n\n",add(30,55));
    printf("Sum= %d.\n\n",t);

    getch();

    }

Similar Threads

  1. Delegates : Function pointers in programming languages
    By Karumbu in forum Software Development
    Replies: 4
    Last Post: 28-12-2010, 05:34 AM
  2. How can I use the fopen() function in the C++ programming
    By D-Mon in forum Software Development
    Replies: 5
    Last Post: 26-02-2010, 05:32 PM
  3. Replies: 5
    Last Post: 25-02-2010, 03:35 PM
  4. The remove_copy() function : CPP programming
    By Adolfa in forum Software Development
    Replies: 5
    Last Post: 22-02-2010, 05:35 PM
  5. The OOP Object Oriented programming Concept & its principle?
    By Bhavya in forum Software Development
    Replies: 3
    Last Post: 25-02-2009, 09:16 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,751,711,156.73745 seconds with 16 queries