Simple array/pointer problem...
If I declare a character array and want to add an item to the array, without having it point to that item, for example:
Code:
Code:
char * arr[50];
char temp[255];
for(loop where temp is always changing)
{
array[i] = temp;
}
for(loop through array)
printf("%s", array[i]);
Results:
Code:
same
same
same
same
How can I make it so that all elements in the array do not point to the current temp value, but point to what temp was at that time? I know its a pointer problem, but I don't really understand pointers that well.