+ 3
Length Of The Input Of Char .
I want to know the length of char in an input. Just like refering to the length of a string input as "str.length" in a for loop.
9 Answers
+ 10
Char is intended to store only one character... so length is one... but if you are referring to char array like char ch[20], then the size is the 20... which represents 20 characters in the char array
+ 10
you also have strlen function. you need to include string.h to use it
+ 4
Okay but in can the user inputs 12 characters instead of the 20 how can i get the length value
+ 4
or I will have to create a seperate class for that??
+ 4
Thanks EveryBody. I have the answer now
+ 3
Even in strings, length is the count of characters in that string.
So for a character array you can use a simple for loop to find out the result.
+ 3
USR::OperatoR See if you understand
https://code.sololearn.com/c4fFM41kJ6KM/?ref=app
0
1 byte