+ 1

Please anyone tell me how can we find the length of a string without using strlen??

plz give me the coding for finding the length of. a string! plz

27th Jan 2017, 4:40 PM
sachin
2 Answers
+ 7
You must be knowing a string ends with '\0'. So you could start counting the characters stored in the string until it reaches '\0', that will give you the length of the string.
27th Jan 2017, 6:12 PM
Saumya
Saumya - avatar
+ 1
to find the end just use an if else statement in a for loop to check each character until you dont reach \0 , and set another variable as a counter to see how many characters are there
1st Feb 2017, 4:19 PM
Prabal Titus
Prabal Titus - avatar