forked from Anooppandikashala/youtube_c_tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc_function.c
More file actions
52 lines (39 loc) · 755 Bytes
/
c_function.c
File metadata and controls
52 lines (39 loc) · 755 Bytes
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
46
47
48
49
50
51
52
#include<stdio.h>
// 1. Function with no argument and no return value.
void printLine()
{
printf("\n__________________________________\n");
}
// 2. Function with no argument but returns a value.
int random()
{
return 10;
}
// 3. Function with argument but no return value.
void printChar(char c)
{
for(int i=0;i<20;i++)
{
printf("%c",c);
}
}
// 4. Function with argument and returns a value.
double getSum(double x, double y)
{
return x+y;
}
void main()
{
//sample code
printLine();
int rand = random();
printf("\n%d",rand);
printLine();
printChar('#');
printChar('#');
printChar('#');
printLine();
double res = getSum(50.2,50);
printf("%f",res);
printLine();
}