Answer Posted / abdur rab
#include <stdio.h>
char* str_str ( char* cp_str, char* cp_pattern )
{
char* cp_temp = NULL;
int n_pattern_length = 0;
n_pattern_length = strlen ( cp_pattern );
while ( cp_str && *cp_str ) {
if ( !strncmp ( cp_str, cp_pattern, (
n_pattern_length ) ) ) {
cp_temp = cp_str;
break;
}
else cp_str++;
}
return ( cp_temp );
}
int main ( int argc, char* argv [ ] )
{
char array [] = {"Hello World"};
char* cp_temp = NULL;
cp_temp = str_str ( array, "lo " );
if ( NULL != cp_temp ) {
printf ("\n%s", cp_temp);
} else printf ("\nReturned null");
return ( 0 );
}
| Is This Answer Correct ? | 12 Yes | 7 No |
Post New Answer View All Answers
Can a pointer be static?
What are keywords in c with examples?
Where local variables are stored in c?
What is the right way to use errno?
what are the facialities provided by you after the selection of the student.
What is the difference between far and near ?
a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. 2) the Event Manager has to send participants to the stage to perform in the order in which they registered. Write a program that will help the Event Manager know who to call to the stage to perform. The Logic should be in Data Structures
What is getch?
What is bash c?
‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.
Explain spaghetti programming?
Was 2000 a leap year?
What is c++ used for today?
Differentiate between a for loop and a while loop? What are it uses?