Function Call by Name in C Programming Language

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……)

An example of function.

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

C language books on Amazon

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


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

void main()



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

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


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

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()

Program Output

Output of above program.
Output of above program.


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?

See results without voting

More by this Author

Comments 292 comments

rajkishor09 profile image

rajkishor09 7 years ago from Bangalore, Karnataka, INDIA Author

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

afshan 7 years ago

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

latha 7 years ago

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

vijay shukla 7 years ago

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

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

CPE_221 7 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 7 years ago

hello, dost its very easy way to understand


girish joshi 7 years ago

plz send that how to program excute.

astha 7 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 profile image

rajkishor09 7 years ago from Bangalore, Karnataka, INDIA Author

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

radhesyama 7 years ago

what is coding of adding two number in function using

C++ developer 7 years ago

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

vidhya 7 years ago

Hai sir/mam:

Thanx for the detail explanation of functions.

nazim 7 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 7 years ago

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

mel22 profile image

mel22 7 years ago from ,

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

bhargav 7 years ago

thankyou providing information

Amar Sawang 7 years ago

This site is very useful to study about C language.

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

profile image

clarysse24 7 years ago

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


input nunber:123456


1 2 3 4 5 6

how you can help me.


deepak 7 years ago

why function return only one value

rohit 7 years ago

what is the diffrence between functions and procedures?

profile image

clarysse24 7 years ago

need help!

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




odd: 1,3,5


even: 2,4,6

sum: 12

hope you can help me. tnx!

rajkishor09 profile image

rajkishor09 6 years ago from Bangalore, Karnataka, INDIA Author



void main()


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



Yasir khattak 6 years ago

I love c language because of my dear sir Akmal shah

I read in cecos university

Akmal shah 6 years ago

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

pooja 6 years ago

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

NANDINI 6 years ago


jyothi 6 years ago

very nice

anu 6 years ago

thanks for the valuable information

Amit 6 years ago

very nice comments

SHARIQUE 6 years ago


mahboob ul haq 6 years ago


johnyem 6 years ago

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



from MIT,Ethiopia

aruna 6 years ago

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

savera 6 years ago

gud haney

asif islam 6 years ago

best way for study

ASHUTOSH BARUA 6 years ago

ya best result in studying

profile image

Narendra Nalin 6 years ago

function is the life in c languge

swapnil 6 years ago

thanks i am well satisfied

k.jeevan reddy 6 years 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 6 years ago

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

sohail aslam 6 years ago

very helpful for learning fuction/

swapnil raykar 6 years ago

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

kashif khursheed 6 years ago

gr8 2 learn

kashif khursheed 6 years ago

gr8 become the fan of this site

mani 6 years ago

i am a fan of this site

AshwiniDG 6 years ago


Ankur 6 years ago

I want to know what is function

Me 6 years ago

I don't understand!!

Ravi 6 years ago

Its very useful for the begineers.

Thnks a lot for this article.

samba 6 years ago

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

Praveen Reddy.G 6 years ago

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

SUDHI S P 6 years ago

i cant itself i am confusing

Rahul Rawat 6 years ago

Only good.....

Dar 6 years ago

this tutorial is great!! thanks!! Good Job

shalim 6 years ago

It is useful for me

cmscstud11 6 years 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, to code this using a function?? pls help. thank you.

pavithra 6 years ago

how to insert integer values into a rectangle using c graphics

TRISHARAN 6 years 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 6 years ago


gopalsingh 6 years ago

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

Thiru 6 years ago

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

vishal 6 years ago

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

rani 6 years ago

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

tarak 6 years ago

Dear friend,

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

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

hicban 6 years ago

wats the 2 types of function C

shuvankar dey 6 years ago

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

9-[; 6 years ago


neeru 6 years ago

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

sanjoy chokrobirtteey 6 years ago

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

Hanuman Saran 6 years ago

I am hanuman saran from bikaner

are you great teacher thanks for answer of main function

arun 6 years ago

simple and best

raghuramsingh 6 years ago

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

Steevan Roham 6 years ago

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

SHARON 6 years ago


sanddep 6 years ago

it is very great t

neha 6 years ago


rohit 6 years ago

i loved reading it

priyanka 6 years ago

it is very bad

keyur 6 years ago

c subject is a very pakav subject

nayan shill -MOB-9707184966 6 years ago


gaddamsailu 6 years ago

in this site explanation of c language is good

kumutha 6 years ago

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

shweta 6 years ago

why function is need in any programming language?

rajkishor09 profile image

rajkishor09 6 years ago from Bangalore, Karnataka, INDIA Author

@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 6 years ago


Daljit kumar 6 years ago

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

mukesh 6 years ago

can u give an example with RETURN();

kavya 6 years ago

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

kavya 6 years 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 6 years 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 6 years ago

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

mohammed khaleed patel 6 years ago

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

ganeshpahade 6 years ago

Very Good Explination

Johnmary 6 years 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  6 years 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 "



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()








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 6 years ago

i want to know about pointers

Neeraj Sharma 6 years ago

dear sir,

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

rajat 6 years ago

its crap

Rajasri 6 years ago

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

arun ceg,chennai 6 years ago

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

S.ArunBalachandren 6 years ago

Hello Tarun

Your code is working



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()









Sum of 10 and 15 is 25.

Sum of 55 and 64 is 119.

Sum of 168 and 325 is 493.

ALI C.H 6 years ago

nice detail i understand it solve my problm


Ramesh 6 years ago

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

mahender 6 years ago

I want more information about functions.

satyendra 6 years ago

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

Abdalla 6 years ago

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

richa 6 years ago

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

rajkishor09 profile image

rajkishor09 6 years ago from Bangalore, Karnataka, INDIA Author

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 6 years ago

Very nice website it is

fari 6 years ago

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

Rakesh raj kumar 6 years ago

it is simply

and its example is very superb.


RANJIT 6 years 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 6 years ago

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

RANJIT (MCA) FROM GNDU 6 years ago


subhasnigdha 6 years ago

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

ranjani 6 years ago

give me details of mathematical and string functions in c

shiva 6 years 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 "".............

jitendra 6 years ago

3d array initialization kaise hota hai

priya 6 years ago

thank u was useful to me

Pabani 6 years ago

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

Akash 6 years ago

really Good and knowledgeable keep good going....

Imran Khan 6 years ago

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

I am a Student of MCA

ali 6 years ago


Rana Waqar 6 years ago

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

Amir 6 years ago

nice example

aditi 6 years ago

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

rashmi 6 years ago


anoop  6 years ago

hello sir...

why are use the function and pointer in c Language?

shantanu raaz 6 years ago



mohit 6 years ago

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

Hani chand 6 years ago

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

surya raju 6 years 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 6 years ago

i want to know about c function one by one

Ali Salman 6 years 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 6 years ago

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

sai(apple) 6 years ago

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

shakeer 6 years ago

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

saipraveen 6 years ago


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 6 years ago

great, thank you for your pages !!!

pratik 6 years ago

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

salam anwer 6 years ago

too bad i dont like software.

software engineer will be no job n next 1 year

r.sowmya sri 5 years ago

sir plz explain about standard functions

Amrik 5 years ago

jina marji parrh lo job ta koi milnai nahi hegi

rahul 5 years ago

sir tell ma about array use in function

Nagaraju 5 years 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 5 years ago

c program is i con't undrstsnd plz help me

ayesha 5 years 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  5 years ago

thnx a lot.

surendran 5 years ago

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

surendran 5 years ago

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

chandra kr shill 5 years ago

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

nayanshill@ 5 years 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,Level 2 semester 2011 year

aruna 5 years ago

thx to clear the concept of function

geetha 5 years 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

 5 years 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 5 years ago

i wanna learn c language plese teach me

Shriom 5 years ago

Thnx 4 ,,,better definition of FUNCTION

AJAY RAI (CHD) 5 years ago


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

Atta hussain 5 years ago

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

zafar abbas 5 years ago


lote of thanks for telling and descraption of function

Jez 5 years 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 5 years ago

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

sadi 5 years ago

its very helpful for me thanks

fish 5 years ago

I am most powerfull student.

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

with great kindely

ravikumar 5 years ago

k good not bad

Pushpendra Yadav 5 years ago

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

zaphire 5 years ago

very very useful..

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

arwinder 5 years ago

thx... sir

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

shweta sharma 5 years ago

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

kinnera 5 years 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 5 years ago


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 profile image

rajkishor09 5 years ago from Bangalore, Karnataka, INDIA Author

@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 5 years ago

c subject is the very simple

student 5 years ago

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

manju 5 years ago

thank u for the gr8 informations

shilpa 5 years 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 5 years ago

nice bhaiyya..!!!

praneetha 5 years ago

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

vamsi 5 years ago

its fine.....

Ravi chandra 5 years ago

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

mohan kumar 5 years ago

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

nitika 5 years ago

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

amit sharma 5 years ago

change your example

Ravi 5 years 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

I think you help me

Thangamani 5 years ago

good explanation:)

dazzling 5 years ago

it is very useful...


Mansuri Nurulhuda (student of BCA) 5 years 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 ....


aruna.n 5 years ago

if we understand it is easy to solve functions

hi 5 years ago

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

ashwin 5 years ago

is it any person capable who not know much

sathish 5 years ago

nice example

Joseph Kate Sobrio 5 years ago


venkatesan 5 years ago

hello brother is this enough to study c language?

rambo 5 years ago

a good example

sushmita gupta 5 years 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 5 years ago

pls how solve the infix to prefix & prefix evaluation

Chaithanya 5 years ago


i need a program for a calculation as follows







what's the logic please help me

Yogesh Ghariya 5 years ago

thanx a lot!!!

rajkishor09 profile image

rajkishor09 5 years ago from Bangalore, Karnataka, INDIA Author

@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 5 years ago

thanx for this help

parminder singh 5 years ago

it is more efficient for knowledge

mahmud 5 years ago


kutubuddin azad 5 years 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 5 years ago

i want to know full discription abaut functions in c

jay 5 years ago

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

sanuj +91-9809600720 5 years ago

i want to know both Advantages and Disadvantages of C functions

m.ramadivya 5 years ago

good for reading it

sandy 5 years ago



paras rajput 5 years ago

nice it solve my problem

diksha 5 years ago

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

raju karri 5 years ago

the programm was gud and its a nice procedure

barkha 5 years ago

pls explain c progrmming ??

ilia 5 years ago

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

profile image

elanr 5 years ago

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


void (int x, int y, int result)

EMAN 5 years ago

Thanx for providing guideeness

shah 5 years ago

hi sir

i really understand from this description. so thnx dear

akasha 5 years ago

dear sir!

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

dip 5 years ago

i'm realy thankful to u.

gaurav nigam 5 years ago


Balaji Naidu 5 years ago

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

maneesh dwivedi 5 years ago

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

nk 5 years ago


ankur 5 years ago

what is the program of multiplication in function

aruna 5 years ago


5 5

5 5 5

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

rohit 5 years ago

sir plz give me details fuction in c for collage seminar

renuka 5 years ago

sir please explain deeply about function prototype and finction defination 5 years ago

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

nek yadav 5 years ago

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

Ron 5 years ago

thnks for info

nag 5 years ago

thank you

soham 5 years ago

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

M Junaid Awan 5 years ago

good job man....

Hi.. mukesh kumar from varanasi 5 years ago

It is a good progrram using function.

dinu(baby) 5 years ago

thanx, it's good using function.

A/razak haji 5 years ago

My problems in c function are solved now

aravind 5 years ago

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

Asif Raza 5 years ago

bundle of thanks ,i have learnt much of functions

kishan patel 5 years 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 when you are online,please tell me

kishan patel 5 years 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 profile image

rajkishor09 5 years ago from Bangalore, Karnataka, INDIA Author

@Kishan Patel : factorial program is already there, visit

jessy 5 years ago

Hi,some doubts..

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

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


priya 5 years ago


its very useful...

Nancy 5 years ago

thanks a lot.

Rajesh 5 years ago

hi, mr.raj

am asking: 1. what is prototype?

can explain other way plz.

2. call by value,call by reference ?

trishul 5 years ago

please explain the program, how the execution will done:

int main()


int c=printf("hello");

return 0;



Tanu sharma 5 years ago

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

abc 5 years ago

plz sir explain need of user defined function

sunil nirmalkar 5 years 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 :-

biplab 5 years 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 profile image

rajkishor09 5 years ago from Bangalore, Karnataka, INDIA Author

@Biplab: You can find that information here

now refreshed pravin 5 years 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 to this

rajkishor09 profile image

rajkishor09 5 years ago from Bangalore, Karnataka, INDIA Author

@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 5 years ago

m asking 1 que.....

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

rajkishor09 profile image

rajkishor09 5 years ago from Bangalore, Karnataka, INDIA Author

vineela 5 years ago

we can know more new things in c-programs

madura bharathi 5 years ago

no comment

TANUJA 5 years ago


Banker 5 years ago

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

ankita gupta 5 years ago

it is very useful thanx to give us brief knowledge

sandeep 5 years ago

its very helpful for me thanks

Rahul Rawat 5 years ago

thanks sir it was amazing.

shalaka gharade 5 years ago

thanks dude

rogelio 4 years 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 4 years ago

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

daman bakhariya 4 years ago

very good who have posted this

hussainbutt 4 years ago

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

piusraiser 4 years 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






heena 4 years ago

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

hera 4 years ago

its so nice

hera 4 years 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 4 years 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 4 years 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 years 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 years ago

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

rajkishor09 profile image

rajkishor09 4 years ago from Bangalore, Karnataka, INDIA Author

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

vijay 4 years ago

good explanation

Rupesh Kumar 4 years ago

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

bhavna 4 years ago

sir i ask

Megha 4 years ago

Dear sir,want to know about data abstraction in c++.sir I cannot understand it .I think that data abstraction also occur in c language also sir please helpme and please tell me your book of c++ link

rainbow sky 4 years ago

Can help me do this?

Write a complete user friendly menu driven C program to perform Matrix operations such as Addition, Subtraction, Multiplication and Transpose according to the user’s choice.


rocky 4 years ago

thank you so much...

profile image

fredfmah 4 years ago

Dear Raj, many thanks for a clear exposition of each theme.

I didn't see an example for something similar to what I am trying to code.

I am using a Pic 18F2550 and the C18 c0mpiler.

The program itself is very simple in structure.


NTC thermistor -- 18F2550 -- LCD 44780


Yes a thermometer.

You explained some very important things to me. I program quite well in Pic Assembler but you helped me see.

1. What in C is named as a function, It is named as a subroutine in assembler

2. The assembler program usually has a MAIN which basically "call" a set of subroutines.

You showed me the Call word is not need in C, naming the subroutine is sufficient

3. Just one little problem .

In the above thermometer example, before you can send data to the LCD, you need to Initiate with a series of set up commands.

This is a ONE TIME block of code.

Then after that the following functions are


sequence then is

0. Initiate

1. Read NTC resistance do 10bit voltage to Resistance conversion..

2.Do maths to convert the resistance to temperature

3. Send temperature to the LCD

4. Go back to 1. for the next temperature reading.

I'm thinking this is a loop , an infinite while(1) loop only broken by an out of range voltage.

Then print resistance error.

I'll keep on reading your C seminar to see if you think something like this could be of general interest.

My best wishes


Madrid, Spain

faisal 4 years ago

yar main ny jitny b functions waly programs try kiye hain koi b nai chala hi... sir your program is also dont working so give me some more examples. with full syntex. thanx

mah 3 years ago

what is the differece between formal and actual arguments?

aashi 3 years ago


pihu 3 years ago

thanks, it help me to understand function . but give more example for better understanding

Rono Dominic 3 years ago

What is the difference between calling a function by value and by reference?

Nu Dombkowski 3 years ago

[quote]8192 characters left.[/quote]

Good write ups, With thanks..

Nicely put, Thanks a lot.

alpa alok 3 years ago


Usha K S 2 years ago

I Cleared my doubts after view'd ur site....


nayanshill@2016 13 months ago

all c++ 2016

DoveFreexrolo 9 months ago

Helpful information. Fortunate me I found your website unintentionally, and I am surprised why this twist of fate didn took place earlier! I bookmarked it.

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.

    Click to Rate This Article