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
what is uses of .net
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
In which layer of the network datastructure format change is done
What is static memory allocation? Explain
how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software
How do I use strcmp?
Should I learn data structures in c or python?
Write a program to check palindrome number in c programming?
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.
List some basic data types in c?
What is difference between stdio h and conio h?
What are the two types of structure?
Explain how can I manipulate strings of multibyte characters?
What's the best way of making my program efficient?
What is keyword with example?