capypad
0 day streak
c / beginner
Snippet

Function Definition

Functions are reusable blocks of code that perform specific tasks. They can take parameters and return a value.

snippet.c
c
1
2
3
4
5
int add(int a, int b) {
return a + b;
}
 
// Usage: int result = add(5, 3);
Breakdown
1
int add(int a, int b)
Defines a function that returns an integer and takes two integer inputs.
2
return a + b;
Sends the sum back to the caller of the function.