c++ - Ending a for loop when a string is empty -



c++ - Ending a for loop when a string is empty -

so have function calls string , converting string int array.

for (i = 0; ; i++) { areainta[i] = area[i] - '0'; areacounter++; }

before had for(i = 0; < 5; i++) because 5 max limit int array, had problems that. how can create status end loop when string has no more values left, because might phone call "50" or "540" or "1" or "1930" etc...

for (i = 0; area[i]!='\0'; i++) { areainta[i] = area[i] - '0'; areacounter++; }

c++

Comments

Popular posts from this blog

javascript - mongodb won't find my schema method in nested container -

Hibernate criteria by a list of natural ids -

ios - Lagging ScrollView with UIWebview inside -