This code compiles fine but when I run it I'm getting a segmentation Fault. I'm not sure why. The program is suppose to Add two numbers without using the + operator.
Code:#include <stdio.h> #include <stdlib.h> int add(int a,int b); int main( int argc, char *argv[] ){ int x; int y; x = atoi(argv[1]); y = atoi(argv[2]); printf("The sum of x and y is %d", add(x,y)); return 0; } int add(int a, int b){ if( a == b) return (a); return(add( ++a , --b ) ); }
Any Help would be greatly appreciated.