Finding first/last occurrence of a character in a string
without using strchr( ) /strrchr( ) function.
Answer Posted / sepideh
#include<iostream>
#include<conio.h>
using namespace std;
int main(){
char m[20];
char x;
gets(m);
x=getch();
for(int i=0;i!=null;i++)
if(m[i]==x){
cout<<i;}
getch();}
| Is This Answer Correct ? | 9 Yes | 0 No |
Post New Answer View All Answers
What is calloc() function?
What are loops in c?
What are structures and unions? State differencves between them.
What is n in c?
What does 4d mean in c?
What is the purpose of void in c?
What are inbuilt functions in c?
What is 02d in c?
What is the difference between char array and char pointer?
main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none
How can I read data from data files with particular formats?
What is huge pointer in c?
How can I get random integers in a certain range?
How do I copy files?
What is array of pointers to string?