#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "strdup.h"


char* strdup(const char* string) {
	return strndup(string, strlen(string));
}


char* strndup(const char* string, size_t length) {
	char* copy = (char*) malloc(sizeof(char) * (length + 1));
	
	strncpy(copy, string, length);
	copy[length] = '\0';
	
	return copy;
}
