intializing an array of strings in C
|
Light Poster
|
|
| 19Jun2009,15:11 | #1 |
|
Hi I have a string , out of which iam trying to extract relevant substrings. the substrings are being stored in an array of strings, now my problem is that initially i need to push the initial string as one of the elements of the array of substrings ( the original string it self), i.e in my array of substrings, the first element should be the string it self.
|
|
Light Poster
|
|
| 20Jun2009,04:30 | #2 |
|
Could you elaborate please?
|
|
Light Poster
|
|
| 21Jun2009,13:22 | #3 |
|
HI this is my query :
I have a string A(A(c)) I have extracted all the substrings of it i.e A(A(c)),A(c),c I have writtena recursive function to extract the substrings, and i need to store the substrings into an array of strings, Iam having issues in doing so lets say if(openbrac_count==closebrac_count & openbrac_count != 0) { strncpy(label[j][50],inputexp,i); j++; } i need to store the substring into the array of strings label, please help. |
|
Light Poster
|
|
| 22Jun2009,17:35 | #4 |
|
If beginning is the index of the first char of inputexp that you want in the substring, and if length is the length of the substring, then
Code:
strncpy(label[j],inputexp+beginning,length); label[j][length] = 0; j++; |
