Find occurence of a character in a sting.
Answers were Sorted based on User's Feedback
Answer / anil kumar nahak
void main()
{
char *st,ch;
int i=0,c=0;
printf("\n Enter The String: ");
gets(st);
printf("\n Enter A character For finding occurance: ");
scanf("%c",&ch);
while(st[i]!='\0')
{
if(st[i]==ch)
c++;
i++;
}
printf("\n %c Present In The String %d Times",ch,c);
}
| Is This Answer Correct ? | 4 Yes | 2 No |
Answer / chanti
strchr()
it is the function which we use in string() while we r
using characters in it.
| Is This Answer Correct ? | 1 Yes | 1 No |
What are integer variable, floating-point variable and character variable?
What is the output of the program #include<stdio.h> #include<conio.h> void main() {0 int i,j=20; clrscr(); for(i=1;i<3;i++) { printf("%d,",i); continue; printf("%d",j); break; } getch(); }
Is javascript written in c?
WAP – represent a char in binary format
Can I initialize unions?
Is it possible to execute code even after the program exits the main() function?
Explain what are multibyte characters?
Explain what are preprocessor directives?
which will return integer? a) int*s ( ) b) ( int* ) s( ) c) int ( *s ) ( )
simple program of graphics and thier outpu display with a want what is out put of graohics in c language
What is c token?
How main function is called in c?