Advertisement
Guest User

Untitled

a guest
Feb 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. void *ft_memset(void *str, int value, unsigned int length)
  2. {
  3. char *string;
  4. unsigned char char_value;
  5.  
  6. char_value = value + '0';
  7. string = str;
  8. while (--length)
  9. {
  10. *string = char_value;
  11. ++string;
  12. }
  13. return (str);
  14. }
  15.  
  16. // gcc's original memset:
  17.  
  18. void *memset(void *dst, int c, size_t n)
  19. {
  20. if (n) {
  21. char *d = dst;
  22.  
  23. do {
  24. *d++ = c;
  25. } while (--n);
  26. }
  27. return dst;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement