Advertisement
Felanpro

Get length of string/array

Feb 22nd, 2019
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.21 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     string x = "Hello there";
  9.     int y = 0;
  10.    
  11.     while(x[y] != '\0')
  12.     {
  13.         y++;
  14.     }
  15.    
  16.     cout << y << endl;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement