+ 1

What is the problem of this program for give me the length of this string ch

#include<stdio.h> #include<string.h> int main(){ char *ch[50]; int i ; printf ("give me string"); gets(ch); while (*ch!='\0') { i=i+1; return i ; } return 0; }

11th Apr 2019, 9:43 PM
Dhai Zeiri
1 Respuesta
+ 1
Im not an expert but first of all u have a return key word that will exit the loop and if you omit the return i u will have an infinite loop condition because u dont iterate over the string ch
12th Apr 2019, 12:01 AM
bxhd