- The Codeclub , smvdu.
Strings
Questions based on strings
In computer programming , a String is a sequence of characters.
or
String is nothing but a character array.
A string is stored in an array of type char ending with the null character '\0 '
char name[10] = "codeclub"
To print:
printf("%s",name);
//or
for(i=0 ; i!='\0' ; i++){
printf("%c",name[i] );
}
To scan:
char name[10];
scanf("%s",name );
To print:
printf("%s", name );
Write a program to take a string from user as input and print that string.
Write a program to find the length of a string.
Write a program to calculate the frequency of a character in a string. ( Take character from user)
Sample Input: i mritunjayvamsi
sample output: Frequency of i is : 2
Write a program to calculate no of vowels and consonants in a string.
Sample Input:
sample output:
No of vowels : 4
No of consonants : 5
Write a program to calculate no of vowels and consonants in a string.
Sample Input:
sample output:
No of vowels : 4
No of consonants : 5