Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is calloc() function?

1093


What are loops in c?

995


What are structures and unions? State differencves between them.

1171


What is n in c?

1032


What does 4d mean in c?

1493


What is the purpose of void in c?

1067


What are inbuilt functions in c?

1032


What is 02d in c?

1071


What is the difference between char array and char pointer?

1049


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

1358


How can I read data from data files with particular formats?

1046


What is huge pointer in c?

1082


How can I get random integers in a certain range?

1061


How do I copy files?

1051


What is array of pointers to string?

1063