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 |
int main() { int *p=new int; *p=10; del p; cout<<*p; *p= 60; cout<<*p; } what will be the output & why?
Why ca not I do something like this?
Write a C program to help a HiFi’s Restaurant automate its breakfast billing system. Your assignment should implement the following items: a. Show the customer the different breakfast items offered by the HiFi’s Restaurant. b. Allow the customer to select more than one item from the menu. c. Calculate and print the bill to the customer. d. Produce a report to present your complete program and show more sample output. Assume that the HiFi’s Restaurant offers the following breakfast menu: Plain Egg $2.50 Bacon and Egg $3.45 Muffin $2.20 French Toast $2.95 Fruit Basket $3.45 Cereal $0.70 Coffee $1.50 Tea $1.80
Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?
How would you use the functions fseek(), freed(), fwrite() and ftell()?
0 Answers Aspire, Infogain, TISL,
Difference between Function to pointer and pointer to function
the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above
What are two dimensional arrays alternatively called as?
Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?
write a c program to convert fahrenheit to celsius?
What is the output for the program given below typedef enum grade{GOOD,BAD,WORST,}BAD; main() { BAD g1; g1=1; printf("%d",g1); }
Write a program to generate the first n terms in the series --- 2,3,5,7,11,...,17