Header file: string.h
The function's prototype is as follows
char * strstr (char * str1, const char * str2 );
str1 is the string to be scannedstr2 is string containing the specific word or character
For example:
Let str[30]="This is a sample"
Let address of str[0] be equal to 2000
Let 'ptr' be a pointer variable pointing to character data[char * ptr]
Now using strstr()
ptr=strstr(str,"sample");
This returns address 2010 to ptr (because in str address 2010 points to 's' of sample)
If the match is not found, strstr() returns a NULL pointer.
If the match is not found, strstr() returns a NULL pointer.
Tags:-strstr(),c programming,address copying
No comments:
Post a Comment