Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 27-11-2009
Member
 
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.
Reply With Quote
  #2  
Old 27-11-2009
Member
 
Join Date: May 2008
Posts: 2,293
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.
Reply With Quote
  #3  
Old 27-11-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
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.
Reply With Quote
  #4  
Old 27-11-2009
Member
 
Join Date: May 2008
Posts: 2,383
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.
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #5  
Old 27-11-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
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:

Quote:
#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();
}
Reply With Quote
  #6  
Old 27-11-2009
Member
 
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:
Quote:
#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();

}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Concept of function in C programming"
Thread Thread Starter Forum Replies Last Post
Delegates : Function pointers in programming languages Karumbu Software Development 4 28-12-2010 05:34 AM
How can I use the fopen() function in the C++ programming D-Mon Software Development 5 26-02-2010 05:32 PM
Help me to implement the partition() function in the C++ language programming Gavyn Software Development 5 25-02-2010 03:35 PM
The remove_copy() function : CPP programming Adolfa Software Development 5 22-02-2010 05:35 PM
The OOP Object Oriented programming Concept & its principle? Bhavya Software Development 3 25-02-2009 09:16 PM


All times are GMT +5.5. The time now is 12:36 AM.