278 views
1 votes
1 votes
#include<stdio.h>
void main()
{
    int a=5;
    int b=f(a);
    printf("%d",b);
}
int f(int x)
{
    x=+5;
    return x;
}

Give output with explanation

1 Answer

0 votes
0 votes
In call by value copy actual parameter into formal

#include<stdio.h>
void main()
{
    int a=5;
    int b=f(a);   //passed as f(5)  
    printf("%d",b);  //output should be 5 as we passed x=5 which got copied in b
}
int f(int x)   //x==5
{
    x=+5;   // x=+5  here we are storing positive integer 5 in x
    return x;  // updating actual parameter  
}

No related questions found