[Solved] My program returns 4 instead of expected value 40 [closed]
You have 2 ways of having a function change data outside it: you can pass a variable by reference and update it, or you can return a value and use that. You are mixing half of each method instead. I reordered the code to make my commentary clearer. #include <stdio.h> int value(int *a); // here … Read more