Is f(int &x) a valid call-by-reference syntax in C?

#include<stdio.h>

int f(int *,int);

int main()
{
int num1,num2,*ptr=&num1;
num1=5;
num2=f(ptr,num1);
printf(“Answer is %d”,num2);

}

int f(int &x,int c){
c=c-1;
if(c==0) return 1;
x=x+1;
return f(x,c)*x;
}

About these ads

Posted on February 22, 2013, in Uncategorized. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: