I have the following code:
void function(int *c1, int *c2){
int val1 = 1, val2 = 2;
c1 = &val1;
c2 = &val2;
}
void main(){
int *c1, *c2;
function(c1, c2);
printf("*c1=%d, *c2=%d\n", *c1, *c2);
}
I need to assign c1 and c2 new values in a function and use them later in main. The function must be 'void'.
I have tried solving this through allocated memory but to no avail. Any help would be appreciated.