1.)No argument and no return
2.)With argument and no return
3.)No argument and with return
4.)With argument and with return
1.)No argument and no return
In this type of function,there is no argument and function doesn't return any value.So,the datatype of the function must be "void"
syntax:-
void function name()
{
statement;
..........
........
}
for example:-
write a program to input two number by the keyboards and calculate sum using function no argument and no return.
void sum()
{
int s,a,b;
printf("\n enter two numbers");
scanf("%d%d",&a,&b);
s=a+b;
printf("\n sum=%d",s);
}
void main()
{
sum();
getch();
}
2.)With argument and no return
3.)No argument and with return
4.)With argument and with return
1.)No argument and no return
In this type of function,there is no argument and function doesn't return any value.So,the datatype of the function must be "void"
syntax:-
void function name()
{
statement;
..........
........
}
for example:-
write a program to input two number by the keyboards and calculate sum using function no argument and no return.
void sum()
{
int s,a,b;
printf("\n enter two numbers");
scanf("%d%d",&a,&b);
s=a+b;
printf("\n sum=%d",s);
}
void main()
{
sum();
getch();
}
👍
ReplyDeleteNice
ReplyDelete