Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

C program compilation error

$
0
0
when this code is compiled to calculate the return value of f(p,p), if the value of p    is initialized to 5 before the call? Note that
 the first parameter is passed by reference, whereas the second parameter is passed by 
 value
#include<stdio.h>
int f(int *p ,int f);
int main()
{
    int p=5,y;
    y=f(&p,p);
    printf("%d",y);
    return 0;
}
int f(int &x,int c)
{
     c = c - 1;
     if (c==0)
     return 1;
     else
    x = x + 1;
    return f(x,c) * x;
}

but i am getting an error what is wrong with my code??


Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>