I am looking for a way to pass a pointer from not main function to another function. A variable x with value 5 sends as pointer to func1, func1 changes variable value to 10, then func1 sends same variable to func2.
I want it to look something like that:
#include <stdio.h>
void func1(int *px);
void func2();
int main(void)
{
int x=5;
printf("x in main %d\n", x);
func1(&x);
return 0;
}
void func1(int *px)
{
*px = 10;
printf("x i funk 1 %d\n", *px);
funk2(); // send to this function a pointer to x, which in this function(func1) is pointed by *px
funk3();
}
void func2()
{
//*px=15 // here I want to change value of x
}