-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathFirstFunction.c
45 lines (38 loc) · 898 Bytes
/
FirstFunction.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*Types of function
1. Standard library function/ Built in function(ex: printf(), scanf(),
strlen(), strcmp(), strcat(), sqrt())
2. User defined function
Declaration:
return_type function_name(){
body of function
}
1. No argument and no return value = void test(){ }
2. No argument but return value = int test(){ }
3. Argument but no return value = void test(int a, int b){}
4. Argument and return value = int test(int a, float b){}
*/
#include <stdio.h>
// Parameterized function
void sum(int num1, int num2)
{
printf("Sum is %d", num1 + num2);
}
// function returning values
int multiply(int num1, int num2)
{
int product = num1 * num2;
return product;
}
int main()
{
// display();
// sum(8,7);
int result = multiply(2, 10);
printf("%d", result);
return 0;
}
// non parameterized function
void display()
{
printf("this is display function");
}