Hey all quick pointer question that I am not understanding...
The following is a quick code snippet of my full program.
Code:
void main()
{
**CODE**
int array[] = {10,20};
int i;
int loc = 0;
i = function(array, loc);
}
int function(int* array, int location)
{
int number = 1;
int j = 0;
j = array[location] + number;
return(j);
}
Again this is not my actual code so there may be syntx errors but the idea of what I want to do is there. I want to pass an array, add it to an internal value and then return that sum. However whenever I do this I am always recalling the memory location the variable is point to and not the value stored at that location. How to I solve this? Thank you for the help!