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 is bubble sort in c?
What does 3 mean in texting?
c program to arrange digits in a no in ascending and descending order
What is quick sort in c?
Differentiate between full, complete & perfect binary trees.
5. distance conversion: Convert a distance from miles to kilometers .there are 5280 feets per mile,12 inches per foot .2.54 centimeters per inch and 100000centimeters per kilometer
main() { int i=5; printf("%d%d%d%d",i++,i--,i); }
What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?
What do you mean by a sequential access file?
difference between string and array?
How do you list files in a directory?
when to use : in c program?