rajkishor09 profile image

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……)
{
Statement1;
Statement2;
Statement3;
}

An example of function.

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

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.
See all 2 photos
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

 Last updated on June 18, 2012

Useful {71}Funny {11}Awesome {22}Beautiful {14}Interesting {5}

Comments 290 comments

rajkishor09 profile image

rajkishor09 5 years ago from Bangalore, Karnataka, INDIA Hub Author

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


afshan 5 years ago

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


latha 5 years ago

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


vijay shukla 5 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 4 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 4 years ago

hello, dost its very easy way to understand

thanx!


girish joshi 4 years ago

plz send that how to program excute.


astha 4 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 4 years ago from Bangalore, Karnataka, INDIA Hub Author

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


radhesyama 4 years ago

what is coding of adding two number in function using


C++ developer 4 years ago

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


vidhya 4 years ago

Hai sir/mam:

Thanx for the detail explanation of functions.


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

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


mel22 profile image

mel22 4 years ago from ,

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


bhargav 4 years ago

thankyou providing information


Amar Sawang 4 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 4 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 4 years ago

why function return only one value


rohit 4 years ago

what is the diffrence between functions and procedures?


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

rajkishor09 4 years ago from Bangalore, Karnataka, INDIA Hub Author

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

I love c language because of my dear sir Akmal shah

I read in cecos university


Akmal shah 4 years ago

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


pooja 4 years ago

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


NANDINI 4 years ago

THIS FUNCTION R VERRY CLEARLY INDSTANDEBAL


jyothi 4 years ago

very nice


anu 4 years ago

thanks for the valuable information


Amit 4 years ago

very nice comments


SHARIQUE 4 years ago

THX ALOT I UNDRSTND DIS LANGUAGE ESLY WAY


mahboob ul haq 4 years ago

Thanks


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

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


savera 4 years ago

gud haney


asif islam 4 years ago

best way for study


ASHUTOSH BARUA 4 years ago

ya best result in studying


Narendra Nalin 4 years ago

function is the life in c languge


swapnil 4 years ago

thanks i am well satisfied


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

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


sohail aslam 4 years ago

very helpful for learning fuction/


swapnil raykar 4 years ago

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


kashif khursheed 4 years ago

gr8 2 learn


kashif khursheed 4 years ago

gr8 become the fan of this site


mani 4 years ago

i am a fan of this site


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

I want to know what is function


Me 4 years ago

I don't understand!!


Ravi 4 years ago

Its very useful for the begineers.

Thnks a lot for this article.


samba 4 years ago

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


Praveen Reddy.G 4 years ago

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


SUDHI S P 4 years ago

i cant understand...now itself i am confusing


Rahul Rawat 4 years ago

Only good.....


Dar 4 years ago

this tutorial is great!! thanks!! Good Job


shalim 4 years ago

It is useful for me


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


pavithra 4 years ago

how to insert integer values into a rectangle using c graphics


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

ITS VERY USEFUL OR ME,THNX FOR THIS TUTORIAL


gopalsingh 4 years ago

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


Thiru 4 years ago

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


vishal 4 years ago

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


rani 4 years ago

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


tarak 4 years ago

Dear friend,

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

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


hicban 4 years ago

wats the 2 types of function C


shuvankar dey 4 years ago

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


9-[; 4 years ago

jpio;i


neeru 4 years ago

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


sanjoy chokrobirtteey 4 years ago

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


Hanuman Saran 4 years ago

I am hanuman saran from bikaner

are you great teacher thanks for answer of main function


arun 4 years ago

simple and best


raghuramsingh 4 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 benifit for that


Steevan Roham 4 years ago

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


SHARON 4 years ago

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


sanddep 4 years ago

it is very great t


neha 4 years ago

ok!!!!!!!!!


rohit 4 years ago

i loved reading it


priyanka 4 years ago

it is very bad


keyur 4 years ago

c subject is a very pakav subject


nayan shill -MOB-9707184966 4 years ago

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


gaddamsailu 4 years ago

in this site explanation of c language is good


kumutha 4 years ago

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


shweta 4 years ago

why function is need in any programming language?


rajkishor09 profile image

rajkishor09 4 years ago from Bangalore, Karnataka, INDIA Hub 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 4 years ago

gooddddddddddddddddddddddddddddddddddd


Daljit kumar 4 years ago

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


mukesh 4 years ago

can u give an example with RETURN();


kavya 4 years ago

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


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

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


mohammed khaleed patel 4 years ago

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


ganeshpahade 4 years ago

Very Good Explination


Johnmary 4 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  4 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 "

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

i want to know about pointers


Neeraj Sharma 4 years ago

dear sir,

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


rajat 4 years ago

its crap


Rajasri 4 years ago

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


arun ceg,chennai 3 years ago

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


S.ArunBalachandren 3 years 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 3 years ago

nice detail i understand it wel.it solve my problm

Thanks


Ramesh 3 years ago

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


mahender 3 years ago

I want more information about functions.


satyendra 3 years ago

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


Abdalla 3 years ago

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


richa 3 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 3 years ago from Bangalore, Karnataka, INDIA Hub 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 3 years ago

Very nice website it is


fari 3 years ago

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


Rakesh raj kumar 3 years ago

it is simply

and its example is very superb.

THANKU


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

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


RANJIT (MCA) FROM GNDU 3 years ago

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


subhasnigdha 3 years ago

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


ranjani 3 years ago

give me deatils of mathematical and string functions in c


shiva 3 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 "writetome.shiva@gmail.com".............


jitendra 3 years ago

3d array initialization kaise hota hai


priya 3 years ago

thank u ..it was useful to me


Pabani 3 years ago

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


Akash 3 years ago

really Good and knowledgeable keep good going....


Imran Khan 3 years ago

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

I am a Student of MCA


ali 3 years ago

dddddd


Rana Waqar 3 years ago

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


Amir 3 years ago

nice example


aditi 3 years ago

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


rashmi 3 years ago

thanx


anoop  3 years ago

hello sir...

why are use the function and pointer in c Language?


shantanu raaz 3 years 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 3 years ago

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


Hani chand 3 years ago

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


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

i want to know about c function one by one


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

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


sai(apple) 3 years ago

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


shakeer 3 years ago

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


saipraveen 3 years 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 3 years ago

great, thank you for your pages !!!


pratik 3 years ago

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


salam anwer 3 years ago

too bad i dont like software.

software engineer will be no job n next 1 year


r.sowmya sri 3 years ago

sir plz explain about standard functions


Amrik 3 years ago

jina marji parrh lo job ta koi milnai nahi hegi


rahul 3 years ago

sir tell ma about array use in function


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

c program is i con't undrstsnd plz help me


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

thnx alot.


surendran 3 years ago

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


surendran 3 years ago

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


chandra kr shill 3 years ago

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


nayanshill@ 3 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,Levle 2 semester 2011 year


aruna 3 years ago

thx to clear the concept of function


geetha 3 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


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

i wanna learn c language plese teach me


Shriom 3 years ago

Thnx 4 ,,,better definition of FUNCTION


AJAY RAI (CHD) 3 years ago

THNX4 FUNCTION DATILS

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


Atta hussain 3 years ago

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


zafar abbas 3 years ago

sir

lote of thanks for telling and descraption of function


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

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


sadi 3 years ago

its very helpful for me thanks


fish 3 years 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 3 years ago

k good not bad


Pushpendra Yadav 3 years ago

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


zaphire 3 years ago

very very useful..

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


arwinder 3 years ago

thx... sir

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


shweta sharma 3 years ago

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


kinnera 3 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 3 years 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 profile image

rajkishor09 3 years ago from Bangalore, Karnataka, INDIA Hub 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 3 years ago

c subject is the very simple


student 3 years ago

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


manju 3 years ago

thank u for the gr8 informations


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

nice bhaiyya..!!!


praneetha 3 years ago

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


vamsi 3 years ago

its fine.....


Ravi chandra 3 years ago

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


mohan kumar 3 years ago

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


nitika 3 years ago

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


amit sharma 3 years ago

change your example


Ravi 3 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 kalyani.siva.siva@gmail.com

I think you help me


Thangamani 3 years ago

good explanation:)


dazzling 3 years ago

it is very useful...

thanku..


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

SEHWAG.MANNA@YAHOO.COM


aruna.n 3 years ago

if we understand it is easy to solve functions


hi 3 years ago

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


ashwin 3 years ago

is it any person capable who not know much


sathish 3 years ago

nice example


Joseph Kate Sobrio 3 years ago

tnx..


venkatesan 3 years ago

hello brother is this enough to study c language?


rambo 3 years ago

a good example


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

pls how solve the infix to prefix & prefix evaluation


Chaithanya 3 years 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 3 years ago

thanx alot!!!


rajkishor09 profile image

rajkishor09 3 years ago from Bangalore, Karnataka, INDIA Hub 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 3 years ago

thanx for this help


parminder singh 3 years ago

it is more efficient for knowledge


mahmud 3 years ago

fantastic


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

i want to know full discription abaut functions in c


jay 3 years ago

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


sanuj +91-9809600720 3 years ago

i want to know both Advantages and Disadvantages of C functions


m.ramadivya 3 years ago

good for reading it


sandy 3 years ago

thnks

c


paras rajput 3 years ago

nice it solve my problem


diksha 3 years ago

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


raju karri 3 years ago

the programm was gud and its a nice procedure


barkha 3 years ago

pls explain c progrmming ??


ilia 3 years ago

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


elanr 2 years 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 2 years ago

Thanx for providing guideeness


shah 2 years ago

hi sir

i really understand from this description. so thnx dear


akasha 2 years ago

dear sir!

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


dip 2 years ago

i'm realy thankful to u.


gaurav nigam 2 years ago

thanks.....


Balaji Naidu 2 years ago

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


maneesh dwivedi 2 years ago

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


nk 2 years ago

thanks


ankur 2 years ago

what is the program of multiplication in function


aruna 2 years ago

5

5 5

5 5 5

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


rohit 2 years ago

sir plz give me details fuction in c for collage seminar


renuka 2 years ago

sir please explain deeply about function prototype and finction defination


ashutoshmishra15@yahoo.in 2 years ago

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


nek yadav 2 years ago

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


Ron 2 years ago

thnks for info


nag 2 years ago

thank you


soham 2 years ago

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


M Junaid Awan 2 years ago

good job man....


Hi.. mukesh kumar from varanasi 2 years ago

It is a good progrram using function.


dinu(baby) 2 years ago

thanx, it's good using function.


A/razak haji 2 years ago

My problems in c function are solved now


aravind 2 years ago

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


Asif Raza 2 years ago

bundle of thanks ,i have learnt much of functions


kishan patel 2 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 topic......so when you are online,please tell me


kishan patel 2 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 2 years ago from Bangalore, Karnataka, INDIA Hub Author

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


jessy 2 years 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 2 years ago

hi,

its very useful...


Nancy 2 years ago

thanks alot.


Rajesh 2 years ago

hi, mr.raj

am asking: 1. what is prototype?

can explain other way plz.

2. call by value,call by reference ?


trishul 2 years ago

please explain the program, how the execution will done:

int main()

{

int c=printf("hello");

return 0;

exit(10);

}


Tanu sharma 2 years ago

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


abc 2 years ago

plz sir explain need of user defined function


sunil nirmalkar 2 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 :- sunilnirmalkar@gmail.com


biplab 2 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 2 years ago from Bangalore, Karnataka, INDIA Hub Author

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


now refreshed pravin 2 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 mob.no to this pls..praveenvenugopal24@yahoo.com...plzzzzzzz...


rajkishor09 profile image

rajkishor09 2 years ago from Bangalore, Karnataka, INDIA Hub 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 2 years ago

m asking 1 que.....

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


rajkishor09 profile image

rajkishor09 2 years ago from Bangalore, Karnataka, INDIA Hub Author


vineela 2 years ago

we can know more new things in c-programs


madura bharathi 2 years ago

no comment


TANUJA 2 years ago

SOMEWHAT CLEAR


Banker 2 years ago

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


ankita gupta 2 years ago

it is very useful thanx to give us brief knowledge


sandeep 2 years ago

its very helpful for me thanks


Rahul Rawat 2 years ago

thanks sir it was amazing.


shalaka gharade 2 years ago

thanks dude


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

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


daman bakhariya 2 years ago

very good who have posted this


hussainbutt 2 years ago

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


piusraiser 2 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

1N

2EE

3PPP

4AAAA

5LLLLL


heena 2 years ago

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


hera 2 years ago

its so nice


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

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


rajkishor09 profile image

rajkishor09 2 years ago from Bangalore, Karnataka, INDIA Hub Author

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


vijay 2 years ago

good explanation


Rupesh Kumar 2 years ago

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


bhavna 2 years ago

sir i ask


Megha 2 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 2 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.

Thanks


rocky 23 months ago

thank you so much...


fredfmah 22 months 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

executed.

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

Fred

Madrid, Spain


faisal 21 months 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 19 months ago

what is the differece between formal and actual arguments?


aashi 18 months ago

0


pihu 18 months ago

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


Rono Dominic 17 months ago

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


Nu Dombkowski 15 months ago

[quote]8192 characters left.[/quote]

Good write ups, With thanks..

Nicely put, Thanks a lot.


alpa alok 13 months ago

super.........................................................................................................


Usha K S 2 months ago

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

THANK U...

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

    8192 characters left.
    Post Comment

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


    Click to Rate This Article
    Please wait working