Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
User defined Function In C
WhatsApp
Ashish Srivastava
Apr 21
2016
590
0
0
#include <stdio.h>
#include <conio.h>
int
add(
int
a,
int
b);
//function prototype(declaration)
void
main()
{
int
num1,num2,sum;
printf(
"Enters two number to add\n"
);
scanf(
"%d %d"
,&num1,&num2);
sum=add(num1,num2);
//function call
printf(
"sum=%d"
,sum);
getch();
}
int
add(
int
a,
int
b)
//function declarator
{
/* Start of function definition. */
int
add;
add=a+b;
return
add;
//return statement of function
/* End of function definition. */
}
User defined function
C
Up Next
User defined Function In C