Skip to main content

Type of user defined function.

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();
}

Comments

Post a Comment

Popular posts from this blog

Important links

  Software Drive https://drive.google.com/drive/folders/1siws7oga-10wdlPhOdcjamlDH6wm0iE_?usp=sharing PPT Drive https://drive.google.com/drive/folders/1lNHhZ4_qlsyHrWA862DyBSvkF_J4YVp8 https://docs.google.com/document/d/1fo_4gFB4sgWfTBfZvK7qf0LP0y9ge1dH/edit

Python Practice questions

Reverse  Check substring in string  Armstrong no or not Palindrome  Table print  Power of the no Factorial