+ 2
How to count length of string without strlen functions
in Any language u know
12 Respuestas
+ 11
C language. : if s is your string ,and l is counter
for(i=0;s[i]!='\0';i++)l++;
printf("%d",l);
+ 14
if u use recursion in place of enhanced for loop in java , then u need to know the no. of elements in char array which will be done by .length method [pre-defined]
//so its better to drop that idea , U can think another
+ 12
convert user input to char array & then run enhanced for loop 4 it , for each iteartion increase value of a variable i by 1
//final value of i will give length of String
//in java[ just thought , on assumption that we can use array & loop]
+ 11
what is strlen functions ?
//does it mean predefined functions
+ 11
\0 is null terminator of a string
https://stackoverflow.com/a/14461727
+ 3
strlen
in javascript is
> string.length
+ 3
thanx #caheamt
+ 2
foreach(char in string){
count++;
}
// print count
+ 2
yes gaurav its predefined function
+ 2
thanx Hannah grace
can u tell me "s[i]!='\0'"<---- it means?
+ 2
i did it with arrey and loop ...but can we do it without using arrey and loop ?
+ 2
recursion ? is it in java