+ 11
Somebody help me ??
Assuming buf is a valid pointer, what is the problem in the code below? What would be an alternate way of implementing this that would avoid the problem? size_t sz = buf->size(); while ( --sz >= 0 ) { /* do something */ }
2 odpowiedzi
+ 4
I assume buf is an object with a method called size. You don't need to specify the >=0 in the while condition. It get's executed until the whole statement is <=0
Here:
https://code.sololearn.com/cNM5ByDCTfXD/?ref=app
If that wasn't the question let me know.
+ 9
thanks