What are called Parameters and write a note on (i) Parameter without Type (ii) Parameter with Type
Answers
Answer:
i) i don't understand
i) i am unable to understand
Explanation:
okay i ka smjha nhi
aur ii ka smjh nhi ayaa
The parameter is referred to as the variables that are defined during a function declaration or definition.
example.
i)
#include <stdio.h>
void function(int, int[], char[]);
int main()
{
int a = 20;
int ar[5] = { 10, 20, 30, 40, 50 };
char str[30] = "geeksforgeeks";
function(a, &ar[0], &str[0]);
return 0;
}
void function(int a, int* ar, char* str)
{
int i;
printf("value of a is %d\n\n", a);
for (i = 0; i < 5; i++) {
printf("value of ar[%d] is %d\n", i, ar[i]);
}
printf("\nvalue of str is %s\n", str);
ii)
#include <math.h>
#include <stdio.h>
int sum();
int main()
{
int num;
num = sum();
printf("\nSum of two given values = %d", num);
return 0;
}
int sum()
{
int a = 50, b = 80, sum;
sum = sqrt(a) + sqrt(b);
return sum;