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...

Write the following function in C.

stripos — Find position of first occurrence of a case-
insensitive string
int stripos ( char* haystack, char* needle, int offset )

Returns the numeric position of the first occurrence of
needle in the haystack string. Note that the needle may be
a string of one or more characters. If needle is not found,
stripos() will return -1.

The function should not make use of any C library function
calls.

Answer Posted / anand kanawally

int stripos ( char* haystack, char* needle, int offset )
{
char *ptr;
ptr=haystack;
int pos=0;
while ( *ptr!='\0' )
{
if( *ptr == *needle )
return pos;
pos++;
ptr++;
}

return -1;
}

Is This Answer Correct ?    4 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the difference between a free-standing and a hosted environment?

1293


What are the different types of data structures in c?

1166


Write a program to print "hello world" without using a semicolon?

1066


Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?

1056


How can a number be converted to a string?

1341


Is c++ based on c?

1075


What do you mean by keywords in c?

1154


What are disadvantages of C language.

1168


A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference

1110


How can a process change an environment variable in its caller?

1191


What is call by reference in functions?

1457


Why is C language being considered a middle level language?

1131


Write a code of a general series where the next element is the sum of last k terms.

1043


Is it acceptable to declare/define a variable in a c header?

1127


What is the role of this pointer?

1075