fork download
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. const char* strings[] = { "", "", "non-empty string" };
  6.  
  7. {
  8. int i = 0 ;
  9. for ( ;*strings[i]; ++i )
  10. ;
  11.  
  12. std::cout << "After for i = " << i << '\n' ;
  13. }
  14.  
  15. {
  16. int i=0;
  17. do
  18. {
  19. ++i ;
  20. } while ( *strings[i] ) ;
  21.  
  22. std::cout << "After do-while i = " << i << '\n' ;
  23. }
  24. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
After for i = 0
After do-while i = 1