char *p; p = (char*) malloc(100);
Option B: it is syntatically wrong.
Option D: syntatically wrong, it should be return(a>b ? a:b);
Option C: it uses nested conditional operator, this is logic for finding greatest number out of three numbers.
Declaration: char *strstr(const char *s1, const char *s2);
Return Value:
On success, strstr returns a pointer to the element in s1 where s2 begins (points to s2 in s1).
On error (if s2 does not occur in s1), strstr returns null.
Example:
#include <stdio.h>
#include <string.h>
int main(void)
{
char *str1 = "CuriousTab", *str2 = "ia", *ptr;
ptr = strstr(str1, str2);
printf("The substring is: %s\n", ptr);
return 0;
}
Output: The substring is: iaCURIOUSTAB
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.