silinos silinos - 1 month ago 11
C Question

I need to pass the arguments of function1 to another function2 inside function1

To be more specific, the code is like this


int a; int b; func(&a,&b); }

void func(int *x,int *y){

func1(...); }/*i need to pass x,y in func1*/

void func1(int ,int ){ ... }

The arguments x,y came from my main and i dont know how to pass them to func1, in order to modify them in the scope of this function


You simply pass them on, but in order for func1 to be able to modify and pass them back you must change func1 to accept pointers.

Your prototype for func1 must be changed to:

    void func1(int* a, int* b);


    void func(int *x,int *y) {
        func1(x, y);