Advertisement
avr39-ripe

sbd192StrExample

Apr 4th, 2020
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int strlenM(const char* str)
  4. {
  5.     int len{ 0 };
  6.     for (; *str++; ++len);
  7.     return len;
  8. }
  9.  
  10. int main()
  11. {
  12.     //char str[15]{ 'H','e','0','o','!','\0'};
  13.     int strSize{ 15 };
  14.     char* string{ new char[strSize] };
  15.     char str[20]{ "Hello, world!" };
  16.     int arr[5]{ 1,2,3,4,5 };
  17.  
  18.     std::cout << str << ' ' << strlenM(str) << '\n';
  19.     std::cout << str << ' ' << strlenM(str) << '\n';
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement