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

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;
}

this function written for exact match of the charecter and
dosent bother for whatever is offset.

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Differentiate between new and malloc(), delete and free() ?

1230


Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

1132


count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array

1135


How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?

2134


please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code

2223


Tell us the use of fflush() function in c language?

1201


Define VARIABLE?

1232


Can you please explain the scope of static variables?

1103


Synonymous with pointer array a) character array b) ragged array c) multiple array d) none

1106


Does c have an equivalent to pascals with statement?

1058


what is the significance of static storage class specifier?

2337


how could explain about job profile

1983


What is typedef example?

1255


Explain what is a const pointer?

1120


How does placing some code lines between the comment symbol help in debugging the code?

1058