Computer Science, asked by Imperialforce9995, 1 year ago

With which function can you find the length of a string? Write a program in C to find the length of a string.

Answers

Answered by pawanpaudel100p9yooy
1

#include <stdio.h>

int main()

{

   char s[1000];

   int i;

   printf("Enter a string: ");

   scanf("%s", s);

   for(i = 0; s[i] != '\0'; ++i);

   printf("Length of string: %d", i);

   return 0;

}

Answered by jisharaj2011
1

Answer:

strlen()

Program:

#include<iostream>

#include<cstring>    //To use strlen() function

using namespace std;

{

  char str[]= "Welcome";

   int n;

   n = strlen(str);

   cout << n;

   return 0;

}

Output will be obtained:

   7.

Explanation:

I hope it will useful for U.

 Thank U

Similar questions