write a programe returns the number of times the character
appears in the string

Answers were Sorted based on User's Feedback



write a programe returns the number of times the character appears in the string..

Answer / mohanraj

if(a[i]==q)

Is This Answer Correct ?    2 Yes 0 No

write a programe returns the number of times the character appears in the string..

Answer / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
char a[50],q;
int count =0;
printf("enter the sring :");
gets(a);
printf("enter the char. to be searched :");
scanf("%c",&q);
for(int i=0;a[i]!='\0';i++)
{
if(a[i]==f)
count++;
}
printf("the occurance is :%d",count);
getch();
}

Is This Answer Correct ?    3 Yes 4 No

Post New Answer

More C Interview Questions

can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......

0 Answers  


What is Generic pointer? What is the purpose of Generic pointer? Where it is used?

3 Answers  


write a c program to convert fahrenheit to celsius?

4 Answers   TCS,


to find out the reverse digit of a given number

6 Answers   Infosys, Microsoft, TCS, Wipro,


what is mallloc()?how it works?

4 Answers   Excel,






difference between semaphores and mutex?

1 Answers  


Why c is a mother language?

0 Answers  


What is use of pointer?

0 Answers  


Explain what is the benefit of using an enum rather than a #define constant?

0 Answers  


Describe the steps to insert data into a singly linked list.

0 Answers  


void main() { int a=1; printf("%d %d %d",a,++a,a++); } the output is supposed to be 1 2 2....but it is 3 3 1 this is due to calling conventions of C. if anyone can explain me how it happens?

7 Answers  


Explain data types & how many data types supported by c?

0 Answers  


Categories