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

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

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