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 HIGH LEVEL LANGUAGE?
what is diff between localstatic and globalstatis variable possible 2 use in another file...?
f() { int a=2; f1(a++); } f1(int c) { printf("%d", c); } c=?
What is difference between static and global variable in c?
convert 0.9375 to binary
What is 02d in c?
24.what is a void pointer? 25.why arithmetic operation can’t be performed on a void pointer? 26.differentiate between const char *a; char *const a; and char const *a; 27.compare array with pointer? 28.what is a NULL pointer? 29.what does ‘segmentation violation’ mean? 30.what does ‘Bus Error’ mean? 31.Define function pointers? 32.How do you initialize function pointers? Give an example? 33.where can function pointers be used?
I need to take a sentence from input and sort the words alphabetically using the C programming language. Note: This is C not C++. qsort and strtok not allowed
who is the editor of 'pokemon'?
write a c program to change only the 3rd bit of the particular number such that other bits are not affected.. if bitnum=10(say.. it can be any no..
What does the && operator do in a program code?
what are the difference between ANSI C and Let Us c and Turbo C