ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

Function Call by Name in C Programming Language

Updated on June 18, 2012

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

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

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?

See results

Comments

    0 of 8192 characters used
    Post Comment

    • rajkishor09 profile image
      Author

      RAJKISHOR SAHU 8 years ago from Bangalore, Karnataka, INDIA

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

    • profile image

      afshan 7 years ago

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

    • profile image

      latha 7 years ago

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

    • profile image

      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?

    • profile image

      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...:((

    • profile image

      rohitash gupta 7 years ago

      hello, dost its very easy way to understand

      thanx!

    • profile image

      girish joshi 7 years ago

      plz send that how to program excute.

    • profile image

      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
      Author

      RAJKISHOR SAHU 7 years ago from Bangalore, Karnataka, INDIA

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

    • profile image

      radhesyama 7 years ago

      what is coding of adding two number in function using

    • profile image

      C++ developer 7 years ago

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

    • profile image

      vidhya 7 years ago

      Hai sir/mam:

      Thanx for the detail explanation of functions.

    • profile image

      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.

    • profile image

      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 !

    • profile image

      bhargav 7 years ago

      thankyou providing information

    • profile image

      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.

      sample

      input nunber:123456

      output:

      1 2 3 4 5 6

      how you can help me.

      thanks!

    • profile image

      deepak 7 years ago

      why function return only one value

    • profile image

      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.

      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
      Author

      RAJKISHOR SAHU 7 years ago from Bangalore, Karnataka, INDIA

      #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

    • profile image

      Yasir khattak 7 years ago

      I love c language because of my dear sir Akmal shah

      I read in cecos university

    • profile image

      Akmal shah 7 years ago

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

    • profile image

      pooja 7 years ago

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

    • profile image

      NANDINI 7 years ago

      THIS FUNCTION R VERRY CLEARLY INDSTANDEBAL

    • profile image

      jyothi 7 years ago

      very nice

    • profile image

      anu 7 years ago

      thanks for the valuable information

    • profile image

      Amit 7 years ago

      very nice comments

    • profile image

      SHARIQUE 7 years ago

      THX A lot I UNDRSTND DIS LANGUAGE ESLY WAY

    • profile image

      mahboob ul haq 7 years ago

      Thanks

    • profile image

      johnyem 6 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

    • profile image

      aruna 6 years ago

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

    • profile image

      savera 6 years ago

      gud haney

    • profile image

      asif islam 6 years ago

      best way for study

    • profile image

      ASHUTOSH BARUA 6 years ago

      ya best result in studying

    • profile image

      Narendra Nalin 6 years ago

      function is the life in c languge

    • profile image

      swapnil 6 years ago

      thanks i am well satisfied

    • profile image

      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

    • profile image

      sachin 6 years ago

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

    • profile image

      sohail aslam 6 years ago

      very helpful for learning fuction/

    • profile image

      swapnil raykar 6 years ago

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

    • profile image

      kashif khursheed 6 years ago

      gr8 2 learn

    • profile image

      kashif khursheed 6 years ago

      gr8 become the fan of this site

    • profile image

      mani 6 years ago

      i am a fan of this site

    • profile image

      AshwiniDG 6 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

    • profile image

      Ankur 6 years ago

      I want to know what is function

    • profile image

      Me 6 years ago

      I don't understand!!

    • profile image

      Ravi 6 years ago

      Its very useful for the begineers.

      Thnks a lot for this article.

    • profile image

      samba 6 years ago

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

    • profile image

      Praveen Reddy.G 6 years ago

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

    • profile image

      SUDHI S P 6 years ago

      i cant understand...now itself i am confusing

    • profile image

      Rahul Rawat 6 years ago

      Only good.....

    • profile image

      Dar 6 years ago

      this tutorial is great!! thanks!! Good Job

    • profile image

      shalim 6 years ago

      It is useful for me

    • profile image

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

    • profile image

      pavithra 6 years ago

      how to insert integer values into a rectangle using c graphics

    • profile image

      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,

    • profile image

      NEHA 6 years ago

      ITS VERY USEFUL OR ME,THNX FOR THIS TUTORIAL

    • profile image

      gopalsingh 6 years ago

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

    • profile image

      Thiru 6 years ago

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

    • profile image

      vishal 6 years ago

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

    • profile image

      rani 6 years ago

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

    • profile image

      tarak 6 years ago

      Dear friend,

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

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

    • profile image

      hicban 6 years ago

      wats the 2 types of function C

    • profile image

      shuvankar dey 6 years ago

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

    • profile image

      9-[; 6 years ago

      jpio;i

    • profile image

      neeru 6 years ago

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

    • profile image

      sanjoy chokrobirtteey 6 years ago

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

    • profile image

      Hanuman Saran 6 years ago

      I am hanuman saran from bikaner

      are you great teacher thanks for answer of main function

    • profile image

      arun 6 years ago

      simple and best

    • profile image

      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

    • profile image

      Steevan Roham 6 years ago

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

    • profile image

      SHARON 6 years ago

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

    • profile image

      sanddep 6 years ago

      it is very great t

    • profile image

      neha 6 years ago

      ok!!!!!!!!!

    • profile image

      rohit 6 years ago

      i loved reading it

    • profile image

      priyanka 6 years ago

      it is very bad

    • profile image

      keyur 6 years ago

      c subject is a very pakav subject

    • profile image

      nayan shill -MOB-9707184966 6 years ago

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

    • profile image

      gaddamsailu 6 years ago

      in this site explanation of c language is good

    • profile image

      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.

    • profile image

      shweta 6 years ago

      why function is need in any programming language?

    • rajkishor09 profile image
      Author

      RAJKISHOR SAHU 6 years ago from Bangalore, Karnataka, INDIA

      @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.

    • profile image

      dsdf 6 years ago

      gooddddddddddddddddddddddddddddddddddd

    • profile image

      Daljit kumar 6 years ago

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

    • profile image

      mukesh 6 years ago

      can u give an example with RETURN();

    • profile image

      kavya 6 years ago

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

    • profile image

      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

    • profile image

      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

    • profile image

      nousheen 6 years ago

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

    • profile image

      mohammed khaleed patel 6 years ago

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

    • profile image

      ganeshpahade 6 years ago

      Very Good Explination

    • profile image

      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?

    • profile image

      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 "

      #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 :-)

    • profile image

      KamalaKannnan 6 years ago

      i want to know about pointers

    • profile image

      Neeraj Sharma 6 years ago

      dear sir,

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

    • profile image

      rajat 6 years ago

      its crap

    • profile image

      Rajasri 6 years ago

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

    • profile image

      arun ceg,chennai 6 years ago

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

    • profile image

      S.ArunBalachandren 6 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.

    • profile image

      ALI C.H 6 years ago

      nice detail i understand it wel.it solve my problm

      Thanks

    • profile image

      Ramesh 6 years ago

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

    • profile image

      mahender 6 years ago

      I want more information about functions.

    • profile image

      satyendra 6 years ago

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

    • profile image

      Abdalla 6 years ago

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

    • profile image

      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
      Author

      RAJKISHOR SAHU 6 years ago from Bangalore, Karnataka, INDIA

      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.

    • profile image

      Saurabh jaiswal 6 years ago

      Very nice website it is

    • profile image

      fari 6 years ago

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

    • profile image

      Rakesh raj kumar 6 years ago

      it is simply

      and its example is very superb.

      THANKU

    • profile image

      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.

    • profile image

      Dharmendar 6 years ago

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

    • profile image

      RANJIT (MCA) FROM GNDU 6 years ago

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

    • profile image

      subhasnigdha 6 years ago

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

    • profile image

      ranjani 6 years ago

      give me details of mathematical and string functions in c

    • profile image

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

    • profile image

      jitendra 6 years ago

      3d array initialization kaise hota hai

    • profile image

      priya 6 years ago

      thank u ..it was useful to me

    • profile image

      Pabani 6 years ago

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

    • profile image

      Akash 6 years ago

      really Good and knowledgeable keep good going....

    • profile image

      Imran Khan 6 years ago

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

      I am a Student of MCA

    • profile image

      ali 6 years ago

      dddddd

    • profile image

      Rana Waqar 6 years ago

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

    • profile image

      Amir 6 years ago

      nice example

    • profile image

      aditi 6 years ago

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

    • profile image

      rashmi 6 years ago

      thanx

    • profile image

      anoop  6 years ago

      hello sir...

      why are use the function and pointer in c Language?

    • profile image

      shantanu raaz 6 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

    • profile image

      mohit 6 years ago

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

    • profile image

      Hani chand 6 years ago

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

    • profile image

      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.

    • profile image

      M DANISH 6 years ago

      i want to know about c function one by one

    • profile image

      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.

    • profile image

      sandeep yadav 6 years ago

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

    • profile image

      sai(apple) 6 years ago

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

    • profile image

      shakeer 6 years ago

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

    • profile image

      saipraveen 6 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.........

    • profile image

      max 6 years ago

      great, thank you for your pages !!!

    • profile image

      pratik 6 years ago

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

    • profile image

      salam anwer 6 years ago

      too bad i dont like software.

      software engineer will be no job n next 1 year

    • profile image

      r.sowmya sri 6 years ago

      sir plz explain about standard functions

    • profile image

      Amrik 6 years ago

      jina marji parrh lo job ta koi milnai nahi hegi

    • profile image

      rahul 6 years ago

      sir tell ma about array use in function

    • profile image

      Nagaraju 6 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.

    • profile image

      siddu 6 years ago

      c program is i con't undrstsnd plz help me

    • profile image

      ayesha 6 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.

    • profile image

      Rinku  6 years ago

      thnx a lot.

    • profile image

      surendran 6 years ago

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

    • profile image

      surendran 6 years ago

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

    • profile image

      chandra kr shill 6 years ago

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

    • profile image

      nayanshill@ 6 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

    • profile image

      aruna 6 years ago

      thx to clear the concept of function

    • profile image

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

    • profile image

       6 years ago

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

    • profile image

      pankaj kumar 6 years ago

      i wanna learn c language plese teach me

    • profile image

      Shriom 6 years ago

      Thnx 4 ,,,better definition of FUNCTION

    • profile image

      AJAY RAI (CHD) 6 years ago

      THNX4 FUNCTION DATILS

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

    • profile image

      Atta hussain 6 years ago

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

    • profile image

      zafar abbas 6 years ago

      sir

      lote of thanks for telling and descraption of function

    • profile image

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

    • profile image

      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.

    • profile image

      sadi 5 years ago

      its very helpful for me thanks

    • profile image

      fish 5 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

    • profile image

      ravikumar 5 years ago

      k good not bad

    • profile image

      Pushpendra Yadav 5 years ago

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

    • profile image

      zaphire 5 years ago

      very very useful..

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

    • profile image

      arwinder 5 years ago

      thx... sir

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

    • profile image

      shweta sharma 5 years ago

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

    • profile image

      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?

    • profile image

      karuna adiraju 5 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
      Author

      RAJKISHOR SAHU 5 years ago from Bangalore, Karnataka, INDIA

      @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.

    • profile image

      Dhaval 5 years ago

      c subject is the very simple

    • profile image

      student 5 years ago

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

    • profile image

      manju 5 years ago

      thank u for the gr8 informations

    • profile image

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

    • profile image

      lucky 5 years ago

      nice bhaiyya..!!!

    • profile image

      praneetha 5 years ago

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

    • profile image

      vamsi 5 years ago

      its fine.....

    • profile image

      Ravi chandra 5 years ago

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

    • profile image

      mohan kumar 5 years ago

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

    • profile image

      nitika 5 years ago

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

    • profile image

      amit sharma 5 years ago

      change your example

    • profile image

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

      I think you help me

    • profile image

      Thangamani 5 years ago

      good explanation:)

    • profile image

      dazzling 5 years ago

      it is very useful...

      thanku..

    • profile image

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

      SEHWAG.MANNA@YAHOO.COM

    • profile image

      aruna.n 5 years ago

      if we understand it is easy to solve functions

    • profile image

      hi 5 years ago

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

    • profile image

      ashwin 5 years ago

      is it any person capable who not know much

    • profile image

      sathish 5 years ago

      nice example

    • profile image

      Joseph Kate Sobrio 5 years ago

      tnx..

    • profile image

      venkatesan 5 years ago

      hello brother is this enough to study c language?

    • profile image

      rambo 5 years ago

      a good example

    • profile image

      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.

    • profile image

      nana 5 years ago

      pls how solve the infix to prefix & prefix evaluation

    • profile image

      Chaithanya 5 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

    • profile image

      Yogesh Ghariya 5 years ago

      thanx a lot!!!

    • rajkishor09 profile image
      Author

      RAJKISHOR SAHU 5 years ago from Bangalore, Karnataka, INDIA

      @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

    • profile image

      shruthi 5 years ago

      thanx for this help

    • profile image

      parminder singh 5 years ago

      it is more efficient for knowledge

    • profile image

      mahmud 5 years ago

      fantastic

    • profile image

      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

    • profile image

      pramod singh 5 years ago

      i want to know full discription abaut functions in c

    • profile image

      jay 5 years ago

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

    • profile image

      sanuj +91-9809600720 5 years ago

      i want to know both Advantages and Disadvantages of C functions

    • profile image

      m.ramadivya 5 years ago

      good for reading it

    • profile image

      sandy 5 years ago

      thnks

      c

    • profile image

      paras rajput 5 years ago

      nice it solve my problem

    • profile image

      diksha 5 years ago

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

    • profile image

      raju karri 5 years ago

      the programm was gud and its a nice procedure

    • profile image

      barkha 5 years ago

      pls explain c progrmming ??

    • profile image

      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?

      eg;

      void (int x, int y, int result)

    • profile image

      EMAN 5 years ago

      Thanx for providing guideeness

    • profile image

      shah 5 years ago

      hi sir

      i really understand from this description. so thnx dear

    • profile image

      akasha 5 years ago

      dear sir!

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

    • profile image

      dip 5 years ago

      i'm realy thankful to u.

    • profile image

      gaurav nigam 5 years ago

      thanks.....

    • profile image

      Balaji Naidu 5 years ago

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

    • profile image

      maneesh dwivedi 5 years ago

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

    • profile image

      nk 5 years ago

      thanks

    • profile image

      ankur 5 years ago

      what is the program of multiplication in function

    • profile image

      aruna 5 years ago

      5

      5 5

      5 5 5

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

    • profile image

      rohit 5 years ago

      sir plz give me details fuction in c for collage seminar

    • profile image

      renuka 5 years ago

      sir please explain deeply about function prototype and finction defination

    • profile image

      ashutoshmishra15@yahoo.in 5 years ago

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

    • profile image

      nek yadav 5 years ago

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

    • profile image

      Ron 5 years ago

      thnks for info

    • profile image

      nag 5 years ago

      thank you

    • profile image

      soham 5 years ago

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

    • profile image

      M Junaid Awan 5 years ago

      good job man....

    • profile image

      Hi.. mukesh kumar from varanasi 5 years ago

      It is a good progrram using function.

    • profile image

      dinu(baby) 5 years ago

      thanx, it's good using function.

    • profile image

      A/razak haji 5 years ago

      My problems in c function are solved now

    • profile image

      aravind 5 years ago

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

    • profile image

      Asif Raza 5 years ago

      bundle of thanks ,i have learnt much of functions

    • profile image

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

    • profile image

      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
      Author

      RAJKISHOR SAHU 5 years ago from Bangalore, Karnataka, INDIA

      @Kishan Patel : factorial program is already there, visit https://hubpages.com/technology/C-Programming-Recu...

    • profile image

      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?

      Thanks..

    • profile image

      priya 5 years ago

      hi,

      its very useful...

    • profile image

      Nancy 5 years ago

      thanks a lot.

    • profile image

      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 ?

    • profile image

      trishul 5 years ago

      please explain the program, how the execution will done:

      int main()

      {

      int c=printf("hello");

      return 0;

      exit(10);

      }

    • profile image

      Tanu sharma 5 years ago

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

    • profile image

      abc 5 years ago

      plz sir explain need of user defined function

    • profile image

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

    • profile image

      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
      Author

      RAJKISHOR SAHU 5 years ago from Bangalore, Karnataka, INDIA

      @Biplab: You can find that information here https://hubpages.com/technology/Types-of-Function-...

    • profile image

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

    • rajkishor09 profile image
      Author

      RAJKISHOR SAHU 5 years ago from Bangalore, Karnataka, INDIA

      @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.............

    • profile image

      shivani 5 years ago

      m asking 1 que.....

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

    • rajkishor09 profile image
      Author

      RAJKISHOR SAHU 5 years ago from Bangalore, Karnataka, INDIA

    • profile image

      vineela 5 years ago

      we can know more new things in c-programs

    • profile image

      madura bharathi 5 years ago

      no comment

    • profile image

      TANUJA 5 years ago

      SOMEWHAT CLEAR

    • profile image

      Banker 5 years ago

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

    • profile image

      ankita gupta 5 years ago

      it is very useful thanx to give us brief knowledge

    • profile image

      sandeep 5 years ago

      its very helpful for me thanks

    • profile image

      Rahul Rawat 5 years ago

      thanks sir it was amazing.

    • profile image

      shalaka gharade 5 years ago

      thanks dude

    • profile image

      rogelio 5 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.

    • profile image

      bipin stha 5 years ago

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

    • profile image

      daman bakhariya 5 years ago

      very good who have posted this

    • profile image

      hussainbutt 5 years ago

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

    • profile image

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

    • profile image

      heena 5 years ago

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

    • profile image

      hera 5 years ago

      its so nice

    • profile image

      hera 5 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.

    • profile image

      indresh bind 5 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.

    • profile image

      aiyein 5 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!

    • profile image

      abdul salam 5 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.

    • profile image

      himanshu gehani 4 years ago

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

    • rajkishor09 profile image
      Author

      RAJKISHOR SAHU 4 years ago from Bangalore, Karnataka, INDIA

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

    • profile image

      vijay 4 years ago

      good explanation

    • profile image

      Rupesh Kumar 4 years ago

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

    • profile image

      bhavna 4 years ago

      sir i ask

    • profile image

      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

    • profile image

      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.

      Thanks

    • profile image

      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

      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

    • profile image

      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

    • profile image

      mah 4 years ago

      what is the differece between formal and actual arguments?

    • profile image

      aashi 4 years ago

      0

    • profile image

      pihu 4 years ago

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

    • profile image

      Rono Dominic 3 years ago

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

    • profile image

      Nu Dombkowski 3 years ago

      [quote]8192 characters left.[/quote]

      Good write ups, With thanks..

      Nicely put, Thanks a lot.

    • profile image

      alpa alok 3 years ago

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

    • profile image

      Usha K S 2 years ago

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

      THANK U...

    • profile image

      nayanshill@2016 15 months ago

      all c++ 2016

    • profile image

      DoveFreexrolo 11 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.

    Click to Rate This Article