Answers for "string length program c"

C
0

string length program c

#include <stdio.h>
#include <string.h>
int main()
{
  char tab[1000];
  int d = 0;

  printf("enter the string :");
  gets(tab);

  while (tab[d] != '\0'){
    d++;
		}
  for (int i=0;i<1000;i++){
		if(tab[i]==' '){
			d--;
			}
	}
	
  printf(" the length of the string: %d\n", d);

  return 0;
}
Posted by: Guest on September-22-2021

Code answers related to "C"

Browse Popular Code Answers by Language