Flag This Hub

C Programming Lesson - Function in C

By


C Language

A function in C language is a block of code that performs a specific task. It has a name and it is reusable i.e. it can be executed from as many different parts in a C Program as required. It also optionally returns a value to the calling program

So function in a C program has some properties discussed below.

  • Every function has a unique name. This name is used to call function from “main()” function. A function can be called from within another function.

  • A function is independent and it can perform its task without intervention from or interfering with other parts of the program.

  • A function performs a specific task. A task is a distinct job that your program must perform as a part of its overall operation, such as adding two or more integer, sorting an array into numerical order, or calculating a cube root etc.

  • A function returns a value to the calling program. This is optional and depends upon the task your function is going to accomplish. Suppose you want to just show few lines through function then it is not necessary to return a value. But if you are calculating area of rectangle and wanted to use result somewhere in program then you have to send back (return) value to the calling function.

C language is collection of various library functions. If you have written a program in C then it is evident that you have used C’s inbuilt functions. Printf, scanf, clrscr etc. all are C’s inbuilt functions. You cannot imagine a C program without function.

Structure of a Function

A general form of a C function looks like this:


<return type> FunctionName (Argument1, Argument2, Argument3……)
{
Statement1;
Statement2;
Statement3;
}

An example of function.

int sum (int x, int y)
{
int result;
result = x + y;
return (result);
}

C language books on Amazon

C Programming Language (2nd Edition)
Amazon Price: $35.64
List Price: $67.00
Programming in C (3rd Edition)
Amazon Price: $24.00
List Price: $49.99
Absolute Beginner's Guide to C (2nd Edition)
Amazon Price: $19.00
List Price: $39.99
C Programming: A Modern Approach, 2nd Edition
Amazon Price: $59.31
C Primer Plus (5th Edition)
Amazon Price: $30.63
List Price: $54.99
C All-in-One Desk Reference For Dummies
Amazon Price: $19.87
List Price: $34.99

Function Prototype and Function Definition in C Programming

Function prototype is very simple concept but the word (prototype) we use to call it makes it difficult to new C programmer to understand. In simple word, function prototype tells compiler that we are going to use a function which will have given name, return type and parameters. It’s that simple.

Function definition on the other hand is just writing logic of any function. For example you have one function prototype in C program for adding two integer numbers (i.e. int add(int, int)) but along with prototype you also have to write logic how that function will behave (respect to above prototype; how you will utilize those two passed integer value and how you will return value) when you will call that function.

Let’s take look at example for better and clear understanding:

Function Prototype and Function Definition Example

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

void myFunction();
int add(int, int);

void main()
{
	clrscr();

	myFunction();
	printf("\n\n%d",add(10,15));

	getch();
}

void myFunction()
{
	printf("This is inside function :D");
}

int add(int a, int b)
{
	return a+b;
}

Explanation

Now we have a simple C program to demonstrate function prototype and function definition concept. We will start from line no. 4 & 5. In these two lines we have function prototype, line no. 4 has a simple function prototype which doesn’t have parameters or return type. It’s very simple to declare a prototype, see line no. 17 & 4, both line are same except prototype requires semicolon (;) at the end. Code block (line no. 17-20) is function definition for our first function prototype (i.e. line no. 4). In this block we are defining behavior of that function and in my code it’s just printing a simple message for demonstration.

Similarly we have second function prototype (line no. 5) and it has parameters and return type. Code block (line no. 22 – 25) is definition of above function prototype. One important point for function prototype having parameters; in prototype, variable name for parameters is optional (see line no. 5). There is no variable name for int parameters, its (int, int). But in that prototype’s function definition you must provide parameter variable name (see line no. 22). We have (int a, int b) parameter name.

One more important thing, if you writing function definition above main() function then you don’t need to write prototype of that function. But it’s a good practice to keep all the functions below main() function.

Advantages of using functions:

There are many advantages in using functions in a program they are:

  1. It makes possible top down modular programming. In this style of programming, the high level logic of the overall problem is solved first while the details of each lower level functions is addressed later.
  2. The length of the source program can be reduced by using functions at appropriate places.
  3. It becomes uncomplicated to locate and separate a faulty function for further study.
  4. A function may be used later by many other programs this means that a c programmer can use function written by others, instead of starting over from scratch.
  5. A function can be used to keep away from rewriting the same block of codes which we are going use two or more locations in a program. This is especially useful if the code involved is long or complicated.

Types of functions:

A function may belong to any one of the following categories:

  1. Functions with no arguments and no return values.
  2. Functions with arguments and no return values.
  3. Functions with arguments and return values.
  4. Functions that return multiple values.
  5. Functions with no arguments and return values.

Note : You can find details about different types of function in C language, click here read it now.

Example of function calling in C

#include<stdio.h>
#include<conio.h>
void add(int x,int y)
{
int result;
result = x+y;
printf("Sum of %d and %d is %d.\n\n",x,y,result);
}
void main()
{
clrscr();
add(10,15);
add(55,64);
add(168,325);
getch();
}
See all 2 photos

Program Output

Output of above program.
Output of above program.

Explanation

Before I explain, let me give you an overview of above c program code. This is a very simple program which has only function named “add()” . Calling this C function from “main()” is very simple. This “add()” function takes two values as arguments, adds those two values and prints the result.

Line 3-8 is a function block of the program. Line no. 3 is the header of function, void is return type of function, add is function name and (int x, int y) are variable which can hold integer values to x and y respectively. When we call function, line no. “12, 13, 14”, we need to send two integer values as its argument. Then these two values get stored in variable x and y of line no. 3. Now we have two values to perform addition; in line no. 5 there is an integer declaration named “result”. This integer will store the sum of x and y (please see line no. 6). Line no. 7 simply prints the result with C’s inbuilt function “printf”.

Now imagine the same program without using function. We have called “add()” function three times, to get the same output without using function we have to write Line no. 6 & 7 three time. If you want to add more value later in the program then again you have to type those two lines. Above example is a small and simple program so it does not appear great to use function. But assume a function consist 20 – 30 or more lines then it would not be wise to write same block of code wherever we need them. In such cases functions come handy, declare once, use wherever you want.

Share your opinion with me

Did this tutorial helped you to learn function in C language?

  • Yes, its clear to me now.
  • No, Still I have some doubts. (Please ask)
  • This article need improvements, its not written clearly.
See results without voting

Comments

rajkishor09 3 years ago

Feel free to ask questions, post suggestion, discuss this with me or other.

afshan 2 years ago

quite difficult 4r beginners........

latha 2 years ago

i never understand about functions clearly . After reading ur topic i understand very well. Thanks a lot.

vijay shukla 2 years ago

Tell me one thing Mr. Raj how function internally operate?

I wanna ask about the existence and working of formal arguements?

CPE_221 2 years ago

SIR can you teach me/us about function with scanf? i suggest about programming a factorial or fibonacci... i just dont really get it how to call the function from main... specially the design...:((

rohitash gupta 2 years ago

hello, dost its very easy way to understand

thanx!

girish joshi 2 years ago

plz send that how to program excute.

astha 2 years ago

I hav to giv a seminar on functions in my college,will u plz suggest me d points that I include n how to answer d queries asked by students? plz answer ma immediately.

rajkishor09 2 years ago

Astha i have created many tutorial on c function. You can check that in my profile. Just browse through my tutorials.

radhesyama 2 years ago

what is coding of adding two number in function using

C++ developer 2 years ago

How can i used multi function in one program???

vidhya 2 years ago

Hai sir/mam:

Thanx for the detail explanation of functions.

nazim 2 years ago

sir thanks a lot for clrearly description of funtion .now i know very well about function.please desc it in c# . i shall very greatful to you.

monika 2 years ago

great to see c language in well defined parts.thank you sooooooooooooooooooooo muchhhhhhhhhhhhhhhhhhhhhhhhhhh

mel22 2 years ago

Thanks. I'll be stopping by to read these chapters day by day. Great info for beginner programmers !

bhargav 2 years ago

thankyou providing information

Amar Sawang 2 years ago

This site is very useful to study about C language.

If you provide us various types of programs then thanks to you.

clarysse24 2 years ago

how would i create a function that would print a several numbers inputted with spaces.

sample

input nunber:123456

output:

1 2 3 4 5 6

how you can help me.

thanks!

deepak 2 years ago

why function return only one value

rohit 2 years ago

what is the diffrence between functions and procedures?

clarysse24 2 years ago

need help!

how would you create a function that finds and add the even and odd numbers present in an input.

example:

input:123456

output:

odd: 1,3,5

sum:9

even: 2,4,6

sum: 12

hope you can help me. tnx!

rajkishor09 2 years ago

#include

#include

void main()

{

int x,arr[10]={1,2,3,4,5,6,7,8,9,10}, even=0, odd=0;

clrscr();

for(x=0;x

Yasir khattak 2 years ago

I love c language because of my dear sir Akmal shah

I read in cecos university

Akmal shah 2 years ago

alaka pa c banday ba zaan poya key kani o ba mo wajnama

pooja 2 years ago

i read in svnpg college of tarkwari. our teacher is Mr. ravi kant chadda.

NANDINI 2 years ago

THIS FUNCTION R VERRY CLEARLY INDSTANDEBAL

jyothi 2 years ago

very nice

anu 2 years ago

thanks for the valuable information

Amit 2 years ago

very nice comments

SHARIQUE 2 years ago

THX ALOT I UNDRSTND DIS LANGUAGE ESLY WAY

mahboob ul haq 2 years ago

Thanks

johnyem 2 years ago

May be i get 30 out of 30 in my mid exam after i read your more explanation.

10q

yemane

from MIT,Ethiopia

aruna 2 years ago

plz teach me eveything in c through mail....................

savera 2 years ago

gud haney

asif islam 2 years ago

best way for study

ASHUTOSH BARUA 2 years ago

ya best result in studying

Narendra Nalin 2 years ago

function is the life in c languge

swapnil 24 months ago

thanks i am well satisfied

k.jeevan reddy 23 months ago

this is jeevan.before read this page i am not perfect c concepts.present understand and i solve some problems.please give more examples.thanking you

sachin 23 months ago

sir can u tell me about working of scanf and printf function that how both functions take multiple arguments........plzzzzzz

sohail aslam 23 months ago

very helpful for learning fuction/

swapnil raykar 23 months ago

little bit clear................

kashif khursheed 23 months ago

gr8 2 learn

kashif khursheed 23 months ago

gr8 become the fan of this site

mani 23 months ago

i am a fan of this site

AshwiniDG 23 months ago

HI I URGENTLY NEED A HELP. I HAVE TO GIVE A SEMINAR ON FUNCTIONS OF C FOR AN HOUR. I WANT ENOUGH INFO ON IT IN SIMPLE LANGUAGE i.e IN LAYMAN LANGUAGE. SO THAT I CAN EXPLAIN IT VERY CLEARLY AND ALSO ABLE TO CLEAR THE DOUBTS ARAISED. I HAVE LESS TIME. IT WILL BE HELPFUL IF I GET IT ASAP

Ankur 23 months ago

I want to know what is function

Me 23 months ago

I don't understand!!

Ravi 23 months ago

Its very useful for the begineers.

Thnks a lot for this article.

samba 23 months ago

what example u gave above nice this is well useful those want learn c progarm

Praveen Reddy.G 22 months ago

it's nice...............

SUDHI S P 22 months ago

i cant understand...now itself i am confusing

Rahul Rawat 22 months ago

Only good.....

Dar 22 months ago

this tutorial is great!! thanks!! Good Job

shalim 22 months ago

It is useful for me

cmscstud11 22 months ago

good day! how to encrypt-decrypt numbers...its goes like this..users are asked to enter 4 digit no. e.g 1,2,3,4 and again will ask them an encryption key lets say 7. the encrypted no. will be 8,9,0,1..how to code this using a function?? pls help. thank you.

pavithra 22 months ago

how to insert integer values into a rectangle using c graphics

TRISHARAN 22 months ago

Excellent! now i need not worry about c languge.

sir, your tutorial is our confidence ,your explanation goal is on pin-pointed notes,

Thanks lot of,

NEHA 22 months ago

ITS VERY USEFUL OR ME,THNX FOR THIS TUTORIAL

gopalsingh 22 months ago

how to insert values of x and y by user....

Thiru 21 months ago

Excellent write up. Useful for my exams...thanks.

vishal 21 months ago

need some more information.......more examples too.....otherwise its good thanks...

rani 21 months ago

How functions defined that is exact to programme.And how to remember there is any commands?

tarak 21 months ago

Dear friend,

It is good.I never understood what is function before. but now i understood clearly.

=========================All the Best============================

hicban 21 months ago

wats the 2 types of function C

shuvankar dey 21 months ago

sir..plz tell me what is the accual defination of libary function?

9-[; 21 months ago

jpio;i

neeru 21 months ago

thanx for such a clear my doubt..............

sanjoy chokrobirtteey 21 months ago

i like dis very much........thanx a lot.........sir...

Hanuman Saran 21 months ago

I am hanuman saran from bikaner

are you great teacher thanks for answer of main function

arun 21 months ago

simple and best

raghuramsingh 21 months ago

hai am raghuramsingh am studying c language i have more doubt in c . what is output why to see the output what the benifit for that

Steevan Roham 21 months ago

Nice one. . . was understandable clearly thanks!!!!!

SHARON 20 months ago

THANX FOR YOUR BRILLIANT MIND... I GOT IT.

sanddep 20 months ago

it is very great t

neha 20 months ago

ok!!!!!!!!!

rohit 20 months ago

i loved reading it

priyanka 20 months ago

it is very bad

keyur 20 months ago

c subject is a very pakav subject

nayan shill -MOB-9707184966 20 months ago

I LOVE C LANGUAGE AND MY TEACHER AMIT DUTTA AND I NAYAN SHILL.I AM A STUDENT OF TEZPUR UNIVERSITY.

gaddamsailu 20 months ago

in this site explanation of c language is good

kumutha 20 months ago

You done a great job.Its very easy to understand.After reading your explanation i got some knowledge about c language.

shweta 20 months ago

why function is need in any programming language?

rajkishor09 20 months ago

@Sweta : function is can ease ur programming. U don't need to write same piece of code again & again if u r using same code. only function call will do. As u can see in my example I have call add() thrice otherwise i had to write all three lines in main() again & again. It would also difficult to maintain readability.

dsdf 20 months ago

gooddddddddddddddddddddddddddddddddddd

Daljit kumar 20 months ago

Hi friend my Q: without the "void main" c program making?

mukesh 20 months ago

can u give an example with RETURN();

kavya 20 months ago

can u give more information about return type programs.i want more explations ls sir

kavya 20 months ago

i want some more material on c language.with easy to understand sir.u r article was good.iam waiting for u r reply sir

Om Khadka 20 months ago

Hi Raj !

Nice job, well elaborated with very easy to understand examples, I would appreciate if you can cover advance level of Data Structure.

MSC. IT Student, Nepal

nousheen 19 months ago

sir really its very helpul for me to learn c in beter way gr8

mohammed khaleed patel 19 months ago

simple and easy to understand...........thanx:-)

ganeshpahade 19 months ago

Very Good Explination

Johnmary 19 months ago

I indeed appreciate the academic interaction.Please,how best can i explain or make presentation on the topic fuction with vivid examples to a lay person begining a C lanuage class?

Tarun  19 months ago

Hi..., This Tarun Frm Bhopal

i have some doubt in C program as per ur Exaple..."Example of a simple function to add two integers "

#include

#include

void add(int x,int y)

{

int result;

result = x+y;

printf("Sum of %d and %d is %d.\n\n",x,y,result);

}

void main()

{

clrscr();

add(10,15);

add(55,64);

add(168,325);

getch();

}

this is my write programme but my result is

*some Statement Missing* SO,......

tell me about why this error in my programme..

& i want to remove this Error ..!!!!

Tell me the Good Sujestion .............!!!!

Rpl. ASAP :-)

KamalaKannnan 19 months ago

i want to know about pointers

Neeraj Sharma 19 months ago

dear sir,

thank for this function detail for learner. a lot of thank on this topic.

rajat 19 months ago

its crap

Rajasri 19 months ago

Give me more information about functions with good examples to easy understanding.

arun ceg,chennai 19 months ago

good explanation for why we are using functions...,

S.ArunBalachandren 19 months ago

Hello Tarun

Your code is working

#include

#include

void add(int x,int y)

{

int result;

result = x+y;

printf("Sum of %d and %d is %d.\n\n",x,y,result);

}

void main()

{

clrscr();

add(10,15);

add(55,64);

add(168,325);

getch();

}

RUN:

Sum of 10 and 15 is 25.

Sum of 55 and 64 is 119.

Sum of 168 and 325 is 493.

ALI C.H 19 months ago

nice detail i understand it wel.it solve my problm

Thanks

Ramesh 19 months ago

thank you for explaining of functions clearly , but I want more problems

mahender 19 months ago

I want more information about functions.

satyendra 19 months ago

sir je please give me ans what is c++ and c and visual basic

Abdalla 19 months ago

Thanks for the above function example,i find it very useful

richa 19 months ago

is there ncessary declaration of functions in c? if we dont declare the functions tnen it will give error message?

rajkishor09 19 months ago

hi richa, i think u should read this article carefully to understand function concept. if a c program does not have function then it is not necessary that it will give u error, its a feature and depends on u whether u want to use it or not.

Saurabh jaiswal 18 months ago

Very nice website it is

fari 18 months ago

aoa sir piz send examples of functions and difference between calling function and declare function

Rakesh raj kumar 18 months ago

it is simply

and its example is very superb.

THANKU

RANJIT 18 months ago

SIR ,IN examples of functions that u have stated ,there is no function declaration part. why ? i have read that function declaration is necessary otherwise there will be error . pls explain.

Dharmendar 18 months ago

It is difficult to understand if we don't know c language...

RANJIT (MCA) FROM GNDU 18 months ago

WHY WE WRITE main() in a C PROGRAM ? WHAT IS THE IMPORTANCE OF MAIN() IN C LANGUAGE ?

subhasnigdha 18 months ago

sir, why () is used in writing a function?

ranjani 18 months ago

give me deatils of mathematical and string functions in c

shiva 18 months ago

sir thankx for information............ but iam a beginner especially i dont three concepts in c program (i.e)structures, pointers and function....... so,kindly help me if u have any notes or program for easy understanding plz send it to my email "writetome.shiva@gmail.com".............

jitendra 18 months ago

3d array initialization kaise hota hai

priya 18 months ago

thank u ..it was useful to me

Pabani 18 months ago

the details are very clear to understand.thanx for helping.

Akash 17 months ago

really Good and knowledgeable keep good going....

Imran Khan 17 months ago

You can Take Help to me In C Programming...

I am a Student of MCA

ali 17 months ago

dddddd

Rana Waqar 17 months ago

very nice brother.........

Amir 17 months ago

nice example

aditi 17 months ago

Very clear explaination with perfect sequence...great !!!

rashmi 17 months ago

thanx

anoop  17 months ago

hello sir...

why are use the function and pointer in c Language?

shantanu raaz 17 months ago

A FUNCTION IS A PROGRAMMING UNIT WHICH CAN BE IDENTIFIED BY A UNIQUE NAME.

ONCE DEFINED, IT CAN BE CALLED BY A PROGRAM

mohit 17 months ago

easier way to undertand c, my logics are not clear.

Hani chand 16 months ago

Hai understood clearly What is the function.explanation is good..i want more pblms related to the function

surya raju 16 months ago

Sir: all this is clear but I want to know where fuctions are applied.I think they are applied in mobile where the main function is sub divided into modules like phone book,settings etc. if htsi argument is correct please send me some examples programs with functions. THANK YOU.

M DANISH 16 months ago

i want to know about c function one by one

Ali Salman 16 months ago

Great Job,

i was confused to learn about these Functions in C.

but now little bit Cleared for me to understand it.

Thanks Sir.

God bless you.

sandeep yadav 16 months ago

sir , please tell me what is main difference in call by value and call by refernce with suitable example.

sai(apple) 16 months ago

What are the called and calling function.plz explain with example.

shakeer 16 months ago

sir , please tell me what is main difference in call by value and call by refernce with suitable example

saipraveen 16 months ago

sir...

wat r arguments nd return value??????

prototypes r classified in 3 types based on arguments nd returnvalues..................

so,, plz kindly explain abt them with good examples

plz sir.........

max 15 months ago

great, thank you for your pages !!!

pratik 15 months ago

as main() functions calls other functions, who does call to main()function ?

salam anwer 15 months ago

too bad i dont like software.

software engineer will be no job n next 1 year

r.sowmya sri 15 months ago

sir plz explain about standard functions

Amrik 15 months ago

jina marji parrh lo job ta koi milnai nahi hegi

rahul 14 months ago

sir tell ma about array use in function

Nagaraju 14 months ago

It's a good explanation about Functions in c language , but i've small doubt in recursive i.e,when function calls it self , how will it returns the value and multiply with the previous value ? i*fact(i-1); now is the value of fact(i-1) is 4 ? pls explain me clearly.

siddu 14 months ago

c program is i con't undrstsnd plz help me

ayesha 14 months ago

before seeing this site i felt functions very difficult but after reading from here i understood about functions clearly THANK YOU SO MUCH.

Rinku  14 months ago

thnx alot.

surendran 14 months ago

it's very useful for me...Thanks a lot...

surendran 14 months ago

it's very useful for me...Thanks a lot...

chandra kr shill 14 months ago

i am chandra kr shill from tezpur assam and 2 no dolabari tezpur university

nayanshill@ 14 months ago

i am nayan shill from Tezpur Assam,

address-> 2-no dolabari Tinmile Tezpur assam.

i am reading in Tezpur University ,,doeacc,,Computer scince ,,

mobile no--9707184966

my class name is --,O,Levle 2 semester 2011 year

aruna 14 months ago

thx to clear the concept of function

geetha 14 months ago

i need the program for this question plz

write a program to read two numbers and swap the values and print it out using functions

 14 months ago

hi @geetha : you need to know "call by value" and "call by reference" concept to do this program. hope u know that.

pankaj kumar 14 months ago

i wanna learn c language plese teach me

Shriom 14 months ago

Thnx 4 ,,,better definition of FUNCTION

AJAY RAI (CHD) 13 months ago

THNX4 FUNCTION DATILS

I LIKE THIS SITE............

Atta hussain 13 months ago

sir i want to be master of c from which can i downloal software

zafar abbas 13 months ago

sir

lote of thanks for telling and descraption of function

Jez 13 months ago

sir. gud day..can you give the code of the program that calculates the discount of customer considering the amount paid for an item. if amount paid is less than 500, it displays thank you. the total payment is xxx.xx. otherwise, display the discount and compute for the net amount a customer has to pay. 20% is given to a customer who purchase more than 500, computation of discount should be located on a certain function which will be called inside the loop.

thank you sir..

i'll be glad and thankful for your immediate response for this..

Naimisha mohapatra 12 months ago

Thank u sir.after reading ur topics in function i really much more satisfied from before. now i m happy.

sadi 12 months ago

its very helpful for me thanks

fish 12 months ago

I am most powerfull student.

but c is my diffecult subject.so how do you advice me in oreder to make c my easiest subject.

with great kindely

ravikumar 12 months ago

k good not bad

Pushpendra Yadav 12 months ago

Its easy to Understand ur topic .i am satisfie ur topip thanks

zaphire 12 months ago

very very useful..

after reading this i understood what is a function n its functionalities..

arwinder 11 months ago

thx... sir

this article helped me a lot.... but could you please show the same program without using functions......

shweta sharma 11 months ago

thanks man for ur invaluable support..............:)

kinnera 10 months ago

sir i am confused in the topics of functioncalling i.e.,call by reference, call by value can u explain me in detail?

karuna adiraju 10 months ago

Sir,

what is the difference between calling function and called function,where we have to write these two .

Sir please post the answer as quickly as possible. And guide us what are the important concepts we have to go through in functions while revising it.

rajkishor09 10 months ago

@kinnera : Ok, i try try to post that soon,

@karuna adiraju : let me give you one small example. Suppose there is two function fruit() and apple(), and inside fruit() and called function apple(). So, fruit() is calling function and apple() is called function.

Dhaval 10 months ago

c subject is the very simple

student 10 months ago

it was absolutely ossso ... all ths days i was nt able to give the technical definition of function

manju 10 months ago

thank u for the gr8 informations

shilpa 9 months ago

Thanks a lot sir........but can i have more info about pointers and arrays...I am a fresher nd i need info urgently.....

lucky 9 months ago

nice bhaiyya..!!!

praneetha 9 months ago

i understood very well the need of function....i am satisfied with your explaination ...thanq sir

vamsi 9 months ago

its fine.....

Ravi chandra 9 months ago

i can't understanding about function please provide some examples and some theory

mohan kumar 9 months ago

i understood very well the need of function....i am satisfied with your explaination ...thanq sir

nitika 9 months ago

i m weak in c. so how can i improve my c

amit sharma 8 months ago

change your example

Ravi 8 months ago

I am read soo much time about function but I don't uderstood

plz help me

summary about function I want to you

plz send me the ans to kalyani.siva.siva@gmail.com

I think you help me

Thangamani 8 months ago

good explanation:)

dazzling 8 months ago

it is very useful...

thanku..

Mansuri Nurulhuda (student of BCA) 8 months ago

here we can must say that without function when we can doing progarm then it is very lengthy, function is veri useful fof increae execution speed of progarm,

it is also useful for built a system software during 2 sem i had taken good experience. so,function is one type of block statement which is user want that what will be want.

------>Mansuri Nurulhuda from chikhli(casps college).

if you will have any problem in programming then just sent your question on to my id ....

SEHWAG.MANNA@YAHOO.COM

aruna.n 8 months ago

if we understand it is easy to solve functions

hi 8 months ago

Please create a program that would exhibit the 4 types of functions.

ashwin 8 months ago

is it any person capable who not know much

sathish 8 months ago

nice example

Joseph Kate Sobrio 8 months ago

tnx..

venkatesan 8 months ago

hello brother is this enough to study c language?

rambo 8 months ago

a good example

sushmita gupta 8 months ago

Hello Sir,

I have a tc through which i execute all my c & c++ pgm.

I want to run Window base pgm through my tc compiler but it has not window.h header file.

How can i add that header file into my tc.

Please sir reply me.

nana 8 months ago

pls how solve the infix to prefix & prefix evaluation

Chaithanya 8 months ago

hi,

i need a program for a calculation as follows

1*8+1=9

12*8+2=98

.

.

.

123456789*8+9=987654321

what's the logic please help me

Yogesh Ghariya 8 months ago

thanx alot!!!

rajkishor09 8 months ago

@Chaithanya : logic looks like (any no.) * 8 + last digit of that (any no.)

1*8+1=9, here last digit is 1

12*8+2=98, here last digit is 2

shruthi 8 months ago

thanx for this help

parminder singh 8 months ago

it is more efficient for knowledge

mahmud 7 months ago

fantastic

kutubuddin azad 7 months ago

in my exam, syllabus for coputer paper is functions of c, but my pages are lost of thus lesson and i was finding this lesson, so, i got it in internt, i am very happy today

pramod singh 7 months ago

i want to know full discription abaut functions in c

jay 7 months ago

how to develop the program swap the no without using variable?

sanuj +91-9809600720 7 months ago

i want to know both Advantages and Disadvantages of C functions

m.ramadivya 7 months ago

good for reading it

sandy 7 months ago

thnks

c

paras rajput 7 months ago

nice it solve my problem

diksha 7 months ago

sir can you please give some more examples of functions that will make it more understandable???

raju karri 7 months ago

the programm was gud and its a nice procedure

barkha 7 months ago

pls explain c progrmming ??

ilia 7 months ago

This is so clear and easy to understand.Thanks a lot.

elanr 7 months ago

Can we pass "result" as interger as argument inside the add function, without passing separately?

eg;

void (int x, int y, int result)

EMAN 7 months ago

Thanx for providing guideeness

shah 7 months ago

hi sir

i really understand from this description. so thnx dear

akasha 6 months ago

dear sir!

i m so much happy for your nice procedure in c.thanks ......

dip 6 months ago

i'm realy thankful to u.

gaurav nigam 6 months ago

thanks.....

Balaji Naidu 6 months ago

will u please post the program explaining using function inside a function.......which explains clearly....pls do favour....

maneesh dwivedi 6 months ago

thank u sir i am very happy to get such help by ur programs

nk 6 months ago

thanks

ankur 6 months ago

what is the program of multiplication in function

aruna 6 months ago

5

5 5

5 5 5

plz send me d 'c' code for the above problem

rohit 5 months ago

sir plz give me details fuction in c for collage seminar

renuka 5 months ago

sir please explain deeply about function prototype and finction defination

ashutoshmishra15@yahoo.in 5 months ago

what are the type conversions ?explain with the help of an example?

nek yadav 5 months ago

thanx dude u are a great teacher. my whole problems are solved now in function.

Ron 5 months ago

thnks for info

nag 5 months ago

thank you

soham 5 months ago

thnx man...saved my ass before my semester.! :)

M Junaid Awan 5 months ago

good job man....

Hi.. mukesh kumar from varanasi 5 months ago

It is a good progrram using function.

dinu(baby) 5 months ago

thanx, it's good using function.

A/razak haji 5 months ago

My problems in c function are solved now

aravind 5 months ago

how to pass the characters using function..(without using pointers)

Asif Raza 4 months ago

bundle of thanks ,i have learnt much of functions

kishan patel 4 months ago

hiiiiiiiiiiiiiiii!!!!!it's really good,but I am a student of 8 grade,so i want extra explanation,will you help by online chat.AS i am intrested in this topic......so when you are online,please tell me

kishan patel 4 months ago

hiiiiii sir,you are awesome but can you give me a program to find the factorial of a number,please post it fast.................

rajkishor09 4 months ago

@Kishan Patel : factorial program is already there, visit http://rajkishor09.hubpages.com/hub/C-Programming-

jessy 4 months ago

Hi,some doubts..

why do u write getch() in void main()?

How do u realize whether your function should return a value?

Thanks..

priya 4 months ago

hi,

its very useful...

Nancy 4 months ago

thanks alot.

Rajesh 4 months ago

hi, mr.raj

am asking: 1. what is prototype?

can explain other way plz.

2. call by value,call by reference ?

trishul 4 months ago

please explain the program, how the execution will done:

int main()

{

int c=printf("hello");

return 0;

exit(10);

}

Tanu sharma 4 months ago

sir plz will u explaun the program of recurrsion plz sir i cnt get tht program

abc 4 months ago

plz sir explain need of user defined function

sunil nirmalkar 4 months ago

sir plz explaun the nots:- 1)introduction to programming 2)Algorithms for problem solving 3)introduction to 'c'lang 4)condition statements and loops 5)arrays 6)function 7)strctures and unions 8)structures and unions 9)pointers 10)self Refential structures and linked lists 11) file processing...plz plz sir i wat my e-mail id :- sunilnirmalkar@gmail.com

biplab 4 months ago

Types of functions:

A function may belong to any one of the following categories:

Functions with no arguments and no return values.

Functions with arguments and no return values.

Functions with arguments and return values.

Functions that return multiple values.

Functions with no arguments and return values.plz explain it

rajkishor09 4 months ago

@Biplab: You can find that information here http://rajkishor09.hubpages.com/_gsm/hub/Types-of-

now refreshed pravin 4 months ago

itzzzz amazing raj..i dint really knew anything abt functions.the way u arrange things with numbering of each line and their link to other line is simply incredible.if i become a gr8 s/w engg,i wud surely say u were the man behind me..i wud be pumped if i cud meet u..,i live in hosur which is quite near to urs..giv ur mob.no to this pls..praveenvenugopal24@yahoo.com...plzzzzzzz...

rajkishor09 4 months ago

@Pravin : Thanks for your nice comments, it really gives motivation to write more tutorials when friends like you appreciate. By the way we can become friends on facebook, in my profile I have provided link. Take care and happy learning.............

shivani 4 months ago

m asking 1 que.....

what is different betbeen call by reference and call by result value

rajkishor09 4 months ago

@shivani: you can read that here http://rajkishor09.hubpages.com/_callby/hub/C-Prog

vineela 3 months ago

we can know more new things in c-programs

madura bharathi 3 months ago

no comment

TANUJA 3 months ago

SOMEWHAT CLEAR

Banker 3 months ago

code for the print the longest word written in a line using udf...plzz reply fast...

ankita gupta 3 months ago

it is very useful thanx to give us brief knowledge

sandeep 3 months ago

its very helpful for me thanks

Rahul Rawat 3 months ago

thanks sir it was amazing.

shalaka gharade 3 months ago

thanks dude

rogelio 2 months ago

hi!sir could you please give me an idea to make this program!!

1. Write a program that determines whether a positive integer is a prime number. A prime number is a number that can only be evenly divided by 1 and itself. The program should contain the function,isPrime, and returns 1 if the integer is a prime number and return 0 if otherwise.

bipin stha 2 months ago

differentiate between call by value and call by referance while calling a function

daman bakhariya 2 months ago

very good who have posted this

hussainbutt 2 months ago

Thank you this is really very helpful for me. Thanks again.

piusraiser 2 months ago

can you help me to solve this program

Print following pattern using a C program.take the string as input from the user .write a genric program to acceptt string of any length...

Example pattern

If the user input nepal than the output should be as follow

1N

2EE

3PPP

4AAAA

5LLLLL

heena 2 months ago

i want to print a rectangle using functions and for loop in c...any help please

hera 2 months ago

its so nice

hera 2 months ago

a program that will take total marks of 3 frndz koli,joli, moli

grading scheme: more than 89=A+,80 to 89=A,70 to 79=B+,

60 to 69=B,50 to 59 =C,less than 50=F.

kathy got the higest .

sample input:75,95,85

sample out put:joli got the higest number.

indresh bind 8 weeks ago

I love c language thanks to chetan vyas sir. mai kuch mahine pahale c me kuch bhi nahi janta tha aur aaj mai program ache se kar leta hu jiska pura shrey chetan sir ko jata hai jisne itni mehanat ke sath mujhe padaya aur mujhe guide kiya thanks sir.

aiyein 8 weeks ago

can you help me to do this?

i cant get the output, but there's no mistakes in my coding.

'write a program that ask the user to enter a temperature reading in centigrade and then prints the equivalent Fahrenheit value. It then ask the user to enter a Fahrenheit value and prints out the equivalent centigrade value. Run the program several times. Be sure to include at least one negative temperature reading in your test cases. Provide separate functions as needed by your design.Your main function should have only function calls. The input, Fahrenheit=100, Celsius=36.9 '

Hope you can help me.. thank you!

abdul salam 4 weeks ago

it's very easy and helpful solution of function . i like it

it's easy example for explain. sorry ,but i am weak in c.

i hope you can helped me.

please give me 'c' notes.

thank you.

himanshu gehani 4 weeks ago

that's call function definition.Very good function describe and give the examples.

rajkishor09 4 weeks ago

If you want you can check types of function tutorials also....

vijay 4 days ago

good explanation

Rupesh Kumar 4 days ago

its verry-verry helpful for me.....

Submit a Comment
Members and Guests

Sign in or sign up and post using a hubpages account.



    Like this Hub?
    Please wait working