Answers for ".length in c language"

C
5

string length c

#include <stdio.h>
#include <string.h>
int main()
{
    char a[20]="Program";
    char b[20]={'P','r','o','g','r','a','m',''};

    // using the %zu format specifier to print size_t
    printf("Length of string a = %zu n",strlen(a));
    printf("Length of string b = %zu n",strlen(b));

    return 0;
}
Posted by: Guest on October-01-2020
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] != ''){
    d++;
		}
  for (int i=0;i<1000;i++){
		if(tab[i]==' '){
			d--;
			}
	}
	
  printf(" the length of the string: %dn", d);

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

Code answers related to "C"

Browse Popular Code Answers by Language