Synopsis:
#include <stdio.h>
void* memchr(const void* cs, int c, int n);
Description:
The memchr function scans cs for the character c in the first n bytes of the buffer.
Return Value
The memchr function returns a pointer to the character c in cs or a null pointer if the character was not found.
Example
#include <stdio.h>
int main()
{
char src [100] = "Search this string from the start";
char *c;
c = (char*)memchr (src, 'g', sizeof (src));
if (c == NULL)
printf ("'g' was not found in the src\n");
else
printf ("found 'g' in the src\n");
return 0;
}
It will proiduce following result:
found 'g' in the src
#include <stdio.h>
void* memchr(const void* cs, int c, int n);
Description:
The memchr function scans cs for the character c in the first n bytes of the buffer.
Return Value
The memchr function returns a pointer to the character c in cs or a null pointer if the character was not found.
Example
#include <stdio.h>
int main()
{
char src [100] = "Search this string from the start";
char *c;
c = (char*)memchr (src, 'g', sizeof (src));
if (c == NULL)
printf ("'g' was not found in the src\n");
else
printf ("found 'g' in the src\n");
return 0;
}
It will proiduce following result:
found 'g' in the src
No comments:
Post a Comment