[Solved] How can I get this value from function stored properly?


You could pass a pointer and de-reference it in the function:

int num5(int* pnum)
{
    *pnum = 5;   // you may want to check that pnum is not NULL
    return 0;    // presumably you don't always return 0 in real code
}

Then

int number = 42;
printf("%d", number); // prints 42
int ret = num5(&number);
printf("%d", number); // prints 5

8

solved How can I get this value from function stored properly?