Please write me the code!!!!!!!!

Q. Write a function that will scan a string for theoccurence of given substring. The prototype of the function would be:
char *substr(char *string1, char *string2);
The function must return a pointer to element in string1 where string2 begins. If string2 doesn't occur in string1 then substr() should return NULL.
For example, if String1 is "This is a car" ans string 2 is "is" then substr() must return address of 'is' in string 1.

Sorry, but it is against forum rules to have us do your homework for you. And if this isn't homework, then you should pay someone to do your work for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.