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
Explain what is wrong with this program statement? Void = 10;
What is difference between structure and union?
The statement, int(*x[]) () what does in indicate?
Explain what are global variables and explain how do you declare them?
What is the difference between printf and scanf )?
Differentiate between the = symbol and == symbol?
‘ C’ PROGRAME TO SHOW THE TYPE OF TRANGLE BY ACCEPTING IT’S LENGTH .
Is main is a keyword in c?
What is "Duff's Device"?
What is pointer and structure in c?
What is the difference between printf and scanf in c?
How can I ensure that integer arithmetic doesnt overflow?
A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.
why return type of main is not necessary in linux
how to create duplicate link list using C???