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 |
How can I increase the allowable number of simultaneously open files?
I have an array of 100 elements. Each element contains some text. i want to: append a star character to the end of every fifth element remove every second character from every tenth element, and… add a line feed (ascii 10) after the 30th character of every array element whose length is greater than 30 characters.
the data type used for unlimited value in c and how to do this program
What is infinite loop?
in linking some of os executables are linking name some of them
How to find a missed value, if you want to store 100 values in a 99 sized array?
how to TOGGLE Nth bit of variable in a MACRO
is assignment operator is arithmatic or not
Explain spaghetti programming?
write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.
Can we declare a function inside a function in c?
main() { int a; a=++100; printf("%d",a); getch(); }