D
dkumar142
Hello frnds,
I have a question. I know answer is quite easy but i think i am missing
some poiter or something..somewhere.
I have to define an array of string
char **s_array1;
now i have to allocate memory.. m strings and each string can hold n
characters..
//i guess.
s_array1 = mxMalloc(m*sizeof(char)); //should it be
sizeof(s_array1)!!
for (i=0;i<m;i++){
s_array1 = mxMalloc(n *sizeof(char));}
//how do i free this?
for (i=0;i<m;i++){
mxFree(s_array);
}
mxFree(s_array);
please point out the errors..
thanks in advance..
I have a question. I know answer is quite easy but i think i am missing
some poiter or something..somewhere.
I have to define an array of string
char **s_array1;
now i have to allocate memory.. m strings and each string can hold n
characters..
//i guess.
s_array1 = mxMalloc(m*sizeof(char)); //should it be
sizeof(s_array1)!!
for (i=0;i<m;i++){
s_array1 = mxMalloc(n *sizeof(char));}
//how do i free this?
for (i=0;i<m;i++){
mxFree(s_array);
}
mxFree(s_array);
please point out the errors..
thanks in advance..