Advertisement
Guest User

Untitled

a guest
Nov 27th, 2015
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.15 KB | None | 0 0
  1. /* ************************************************************************** */
  2. /*                                                                            */
  3. /*                                                        :::      ::::::::   */
  4. /*   ft_popchar.c                                       :+:      :+:    :+:   */
  5. /*                                                    +:+ +:+         +:+     */
  6. /*   By: jcarbonn <marvin@42.fr>                    +#+  +:+       +#+        */
  7. /*                                                +#+#+#+#+#+   +#+           */
  8. /*   Created: 2015/11/27 14:25:34 by jcarbonn          #+#    #+#             */
  9. /*   Updated: 2015/11/27 14:25:36 by jcarbonn         ###   ########.fr       */
  10. /*                                                                            */
  11. /* ************************************************************************** */
  12.  
  13. #include "includes/libft.h"
  14.  
  15. char        *ft_popchar(const char *src)
  16. {
  17.     char    *result;
  18.     int     len;
  19.  
  20.     len = ft_strlen(src);
  21.     result = ft_memalloc(len - 1);
  22.     if (result == NULL)
  23.         return (NULL);
  24.     strncpy(result, src, len - 1);
  25.     result[len - 1] = '\0';
  26.     return (result);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement