string length program c

Solutions on MaxInterview for string length program c by the best coders in the world

showing results for - "string length program c"
Samantha
24 Jan 2021
1#include <stdio.h>
2#include <string.h>
3int main()
4{
5  char tab[1000];
6  int d = 0;
7
8  printf("enter the string :");
9  gets(tab);
10
11  while (tab[d] != '\0'){
12    d++;
13		}
14  for (int i=0;i<1000;i++){
15		if(tab[i]==' '){
16			d--;
17			}
18	}
19	
20  printf(" the length of the string: %d\n", d);
21
22  return 0;
23}
queries leading to this page
string size cstring length program c