Ok so I have an allocated array of strings, lets call it **temp_array
My structures defined below, pretty much I'm trying to store the temp_array[0] into first element, and then store everything else in **temp_array into **new_array
I'm getting a segfault when trying to store anything into **new_array, and can't figure out why.
Code
typedef struct folder{
char *first_element;
char ** new_array;
}Folder;
int i = 1, j = 0;
Folder *new;
new->first_element = temp_array[0]; /* this works fine*/
/* no idea how to point to the temp_array from new_array without segfaulting? */
while(temp_array[i] != NULL){
new->new_array[ j ] = temp_array[ i ]; /* this code isn't working, seg faults */
j++;
i++;
}
This post was edited by lopelurag on Apr 27 2013 09:58am