+ 2

How to find the length of a string in c++?

4th Aug 2017, 6:08 PM
Sabiya
Sabiya - avatar
9 Respostas
+ 4
str.length()
4th Aug 2017, 6:10 PM
Rrestoring faith
Rrestoring faith - avatar
+ 3
in c++ to find the length of string make use of strlen(var_name); var_name is the name of the variable whose length is to be found
9th Sep 2017, 1:51 PM
Sabiya
Sabiya - avatar
+ 2
weather str is a keyword
4th Aug 2017, 6:11 PM
Sabiya
Sabiya - avatar
+ 2
str is whatever your string is called. it's a function m strings have, it will return their length
4th Aug 2017, 6:12 PM
Rrestoring faith
Rrestoring faith - avatar
+ 2
stringname.length();
4th Aug 2017, 6:12 PM
LordGhostX
LordGhostX - avatar
+ 2
thx
4th Aug 2017, 6:13 PM
Sabiya
Sabiya - avatar
+ 2
how to declare a string whose size is not yet known
4th Aug 2017, 6:16 PM
Sabiya
Sabiya - avatar
+ 2
I have declared char str[] but it is giving me error why so
4th Aug 2017, 6:20 PM
Sabiya
Sabiya - avatar
+ 1
That's a problem in C++, C# has this covered by making strings a seperate data type, you can use dynamic memory
4th Aug 2017, 6:18 PM
LordGhostX
LordGhostX - avatar