skip to main |
skip to sidebar
Length & Size of string with string length function
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char str[20];
int len,size;
printf("Enter your name\n");
scanf("%s",str);
len=strlen(str);
printf("Length=%d\n",len);
printf("Size=%d\n",sizeof(str));
getch();
}
OUTPUT:
Enter your name
Tushar
Length=6
Size=20
No comments:
Post a Comment