Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int factorial(int);
- int main(void)
- {
- char x=5;
- printf("%d!=%d",x,factorial(x));
- return 0;
- }
- int factorial(int n)
- {
- if (n==1)
- return (1);
- else
- return (n*factorial(n-1));
- }
- char x=5;
- int n;
- n = x;
- //あるいは
- n = (int)x;
- test.c: In function 'main':
- test.c:7:31: warning: passing argument 1 of 'factorial' makes integer from pointer without a cast [-Wint-conversion]
- printf("%d!=%d",x,factorial(&x));
- ^
- test.c:3:5: note: expected 'int' but argument is of type 'char *'
- int factorial(int);
- ^
Add Comment
Please, Sign In to add comment