Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.16 KB | None | 0 0
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* ft_putchar.c :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: lcuzzuco <marvin@42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2015/07/16 14:09:32 by lcuzzuco #+# #+# */
  9. /* Updated: 2015/07/16 23:13:30 by lcuzzuco ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12.  
  13. #include <unistd.h>
  14.  
  15. void ft_putchar(char c)
  16. {
  17. write (1, &c, 1);
  18. }
  19. /* ************************************************************************** */
  20. /* */
  21. /* ::: :::::::: */
  22. /* ft_putstr.c :+: :+: :+: */
  23. /* +:+ +:+ +:+ */
  24. /* By: lcuzzuco <marvin@42.fr> +#+ +:+ +#+ */
  25. /* +#+#+#+#+#+ +#+ */
  26. /* Created: 2015/07/16 14:13:11 by lcuzzuco #+# #+# */
  27. /* Updated: 2015/07/16 17:20:49 by lcuzzuco ### ########.fr */
  28. /* */
  29. /* ************************************************************************** */
  30.  
  31. #include <unistd.h>
  32.  
  33. void ft_putchar(char c)
  34. {
  35. write(1, &c, 1);
  36. }
  37.  
  38. void ft_putstr(char *str)
  39. {
  40. int index;
  41.  
  42. index = 0;
  43. while (str[index])
  44. {
  45. ft_putchar(str[index]);
  46. index++;
  47. }
  48. }
  49. /* ************************************************************************** */
  50. /* */
  51. /* ::: :::::::: */
  52. /* ft_strcmp.c :+: :+: :+: */
  53. /* +:+ +:+ +:+ */
  54. /* By: lcuzzuco <marvin@42.fr> +#+ +:+ +#+ */
  55. /* +#+#+#+#+#+ +#+ */
  56. /* Created: 2015/07/16 17:47:53 by lcuzzuco #+# #+# */
  57. /* Updated: 2015/07/16 21:35:42 by lcuzzuco ### ########.fr */
  58. /* */
  59. /* ************************************************************************** */
  60.  
  61. #include <stdio.h>
  62.  
  63. int ft_strcmp(char *s1, char *s2)
  64. {
  65. int i;
  66.  
  67. i = 0;
  68. while (s1[i] == s2[i])
  69. {
  70. if (s1[i] == '\0' && s2[i] == '\0')
  71. return (0);
  72. i++;
  73. }
  74. return ((unsigned char)s1[i] - (unsigned char)s2[i]);
  75. }
  76. /* ************************************************************************** */
  77. /* */
  78. /* ::: :::::::: */
  79. /* ft_strlen.c :+: :+: :+: */
  80. /* +:+ +:+ +:+ */
  81. /* By: lcuzzuco <marvin@42.fr> +#+ +:+ +#+ */
  82. /* +#+#+#+#+#+ +#+ */
  83. /* Created: 2015/07/16 15:55:07 by lcuzzuco #+# #+# */
  84. /* Updated: 2015/07/16 16:43:14 by lcuzzuco ### ########.fr */
  85. /* */
  86. /* ************************************************************************** */
  87.  
  88. #include <unistd.h>
  89.  
  90. int ft_strlen(char *str)
  91. {
  92. int i;
  93.  
  94. i = 0;
  95. while (str[i] != '\0')
  96. {
  97. i++;
  98. }
  99. return (0);
  100. }
  101. /* ************************************************************************** */
  102. /* */
  103. /* ::: :::::::: */
  104. /* ft_swap.c :+: :+: :+: */
  105. /* +:+ +:+ +:+ */
  106. /* By: lcuzzuco <marvin@42.fr> +#+ +:+ +#+ */
  107. /* +#+#+#+#+#+ +#+ */
  108. /* Created: 2015/07/16 14:49:26 by lcuzzuco #+# #+# */
  109. /* Updated: 2015/07/16 14:49:58 by lcuzzuco ### ########.fr */
  110. /* */
  111. /* ************************************************************************** */
  112.  
  113. void ft_swap(int *a, int *b)
  114. {
  115. int temp;
  116.  
  117. temp = *b;
  118. *b = *a;
  119. *a = temp;
  120. }
  121. ~/correc06/ex00(master ✔)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement