Question
Hey guys im trying to create a function (in C programming only)that determines if the past array into the function has a blankspace or anything else. Take this declared array for instance: str[] = {m s , s t ,,} index 0 1 2 3 4 5 6 As you can see, index 2,4,6 are considered to be empty. Ifthey are empty I would just like it to ignore that character and goto the next one to store it into a different array that shouldresult something like this: new_str = {m s s t} index 0 1 2 3 any help please?? Take this declared array for instance: str[] = {m s , s t ,,} index 0 1 2 3 4 5 6 As you can see, index 2,4,6 are considered to be empty. Ifthey are empty I would just like it to ignore that character and goto the next one to store it into a different array that shouldresult something like this: new_str = {m s s t} index 0 1 2 3 any help please?? index 0 1 2 3 4 5 6 As you can see, index 2,4,6 are considered to be empty. Ifthey are empty I would just like it to ignore that character and goto the next one to store it into a different array that shouldresult something like this: new_str = {m s s t} index 0 1 2 3 any help please??
Explanation / Answer
string str[]= {"m","s", "","s", "","t", ""}; int length= 7; // create new array tohold non-empty elements string*newstr; newstr =new string[length]; int size= 0; for(int i = 0; i