So I was trying to pass the address to a function and I'm getting some error I think which is not related to passing the address but with the function or something. Here:
Code:#include <stdio.h> int fac(int *px)//prototype //start of main int main(){ int x;//stores the input scanf("%d", &x);//input int factorial;//stores factorial factorial = fac(&x);//passing the address/pointer to x printf("%d", factorial);//printing the factorial return 0; }// end of main //funtion fac calculates factorial //fac starts int fac(int *px){ int factorial = 1;// stores result //start of while/calculating factorial while(*px!=0){ factorial *= *px; *px--; }//while ends return factorial;//returns calculated result }//fac ends