Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string.h>
- void * __attribute__((const)) memchr(const void * mem, int c, size_t num){
- const char * p = mem;
- while(num--){
- if(* p == (char) c) return (void *) p;
- p++;
- }
- return NULL;
- }
- WARNING :
- string/memchr.c: In function 'memchr':
- string/memchr.c:18:30: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
- if(* p == (char) c) return (void *) p;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement