I have since for testing purposes just brought everything into my main method, i tries debugging and notices that the pNumber value, does not change whilst in the loop, regardless of the user inputting the values. which has led me to believe they are not being stored on in memory at all.
Code:
#include<stdio.h>
#include<stdlib.h>
int main()
{
int size;
int *pNumber;
printf("How many elements are in the array? ");
scanf_s("%i", &size);
pNumber = (int *) malloc(size*sizeof(int));
for(int i = 0; i < size; i++)
{
printf("Enter an element of the array: ");
scanf_s("%i", (pNumber+i));
}
printf("%i \n", pNumber);
}
Is this line wrong?
scanf_s("%i", (pNumber+i));
apologies for being a pest, the example in the c book i bought uses values which are hard coded into the program.