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 / varun vithalani

I am working on the answer now but i can say that answer 1
and 2 are absolutely wrong. I haven't checked the 3rd yet.
In 1 and 2 solutions, it only looks for the first character
of the needle and does not care about the remaining.

For example:
haystack = "sweetsugar"
needle = "sugar"

It will return value '0' since it matches the first 's' of
'sweetsugar' and 'sugar'. The answer should be '5'.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is uses of .net

1786


Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix

2064


In which layer of the network datastructure format change is done

1942


What is static memory allocation? Explain

1138


how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software

3371


How do I use strcmp?

1131


Should I learn data structures in c or python?

1072


Write a program to check palindrome number in c programming?

1066


how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.

1734


List some basic data types in c?

1082


What is difference between stdio h and conio h?

1436


What are the two types of structure?

1142


Explain how can I manipulate strings of multibyte characters?

1255


What's the best way of making my program efficient?

1151


What is keyword with example?

1123