Q7. String STL 01
How do you find the size of a string ‘S’?
a-None
b-S.length()
c-s.len()
d-S.size()
Why the answer is not option d ?
Q7. String STL 01
How do you find the size of a string ‘S’?
a-None
b-S.length()
c-s.len()
d-S.size()
Why the answer is not option d ?
@ashish_meher
Hello ashish,
we can find size of string by both ways i.e S.length() and S.size().
here S.size() would be more general answer because it is supported by other stl as well like vector.
but s.length() is supported by string only may be that why they given answer as b.
in my opinion both b,d is correct
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.