How to Use strlen() function in C

/* This program will print the length of the string entered by user. */

#include<stdio.h>
#include<string.h>

void main(void)
{

char str[30];

int len;

printf("\nEnter any String : ");

gets(str);

len=strlen(str);

printf("\nNumber of Character in%s=%d\n",str,len);

getch();
}

Post a Comment

0 Comments