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 |
Explain null pointer.
we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above
What is operator promotion?
Write a program to find factorial of a number using recursive function.
How to get string length of given string in c?
what is the output of the following program? #include<stdio.h> void main() { int x=4,y=3,z; z=x-- -y; printf("\n%d %d %d",x,y,z); }
What are the differences between new and malloc in C?
How do you print an address?
what is the difference between normal variables and pointer variables..............
15 Answers HP, Infosys, Satyam, Vivekanand Education Society,
How can I get Single byte from 'int' type variable? Can we alter single bit or multiple bits in int type variable? if so, How?
Who invented bcpl language?
how c source file in converted to exe file