0
In the below question I can get the str lengthif I use array for char a,but how to get length of character without using array
#include <stdio.h> #include<string.h> int main() { char a; char b[20]={'P','r','o','g','r','a','m','\0'}; printf("Enter any character \n"); scanf("%c\n", &a); printf("%d\n",strlen(a)); printf("Length of string b = %zu \n",strlen(b)); return 0; }
3 ответов
0
Length of character without array is always 1. Because char can hold only 1 character.
0
Thank you soo much I forgot the logic