#include<stdio.h>
void swap(int m, int n)
{
int x = m;
m = n;
n = x;
}
main()
{
int x=2, y=3;
swap(x,y);
printf("%d %d", x, y);
}
A. 2 3
B. 3 2
c. 2 2
D. Error
Answer:a
When is the “void” keyword used in a function?
When declaring functions, you will decide whether that function would be returning a value or not. If that function will not return a value, such as when the purpose of a function is to display some outputs on the screen, then “void” is to be placed at the leftmost part of the function header. When a return value is expected after the function execution, the data type of the return value is placed instead of “void”.
Back
You may like the following posts:
Functions
No comments:
Post a Comment