Post Deleted by Community
    Post Locked by Community
    Post Migrated Away to stackoverflow.com by Rui F Ribeiro, Jeff Schaller
    Post Closed as "off-topic" by Rui F Ribeiro, Jeff Schaller
2 Make code readable
source | link

I'm trying to run the program below in my c unix editor to see if it works but I keep getting a segmentation fault and I don't know why.

include

int main(void) { int f(int, int);

int x=4; int y=2; int sum;

sum = f(x,y);

printf("The result of applying f to %3d and %3d is %3d\n",x,y,xum): return 0; }

int f(int x, int y) { int ans;

if(x ==y) ans = x; else ans = 1 + f(x,y-2);

return (ans); }

#include <stdio.h>
int main(void)
{
 int f(int, int);

 int x=4;
 int y=2;
 int sum;

 sum = f(x,y);

 printf("The result of applying f to %3d and %3d is %3d\n",x,y,sum);
 return 0;
}


int f(int x, int y)
{
 int ans;

 if(x ==y)
  ans = x;
 else
  ans = 1 + f(x,y-2);

 return (ans);
}

I'm trying to run the program below in my c unix editor to see if it works but I keep getting a segmentation fault and I don't know why.

include

int main(void) { int f(int, int);

int x=4; int y=2; int sum;

sum = f(x,y);

printf("The result of applying f to %3d and %3d is %3d\n",x,y,xum): return 0; }

int f(int x, int y) { int ans;

if(x ==y) ans = x; else ans = 1 + f(x,y-2);

return (ans); }

I'm trying to run the program below in my c unix editor to see if it works but I keep getting a segmentation fault and I don't know why.

#include <stdio.h>
int main(void)
{
 int f(int, int);

 int x=4;
 int y=2;
 int sum;

 sum = f(x,y);

 printf("The result of applying f to %3d and %3d is %3d\n",x,y,sum);
 return 0;
}


int f(int x, int y)
{
 int ans;

 if(x ==y)
  ans = x;
 else
  ans = 1 + f(x,y-2);

 return (ans);
}
1
source | link

My program has a segmentation fault

I'm trying to run the program below in my c unix editor to see if it works but I keep getting a segmentation fault and I don't know why.

include

int main(void) { int f(int, int);

int x=4; int y=2; int sum;

sum = f(x,y);

printf("The result of applying f to %3d and %3d is %3d\n",x,y,xum): return 0; }

int f(int x, int y) { int ans;

if(x ==y) ans = x; else ans = 1 + f(x,y-2);

return (ans); }