// memcpy alternative
#include <stdio.h>
#include <string.h>
void* memcpyX(char* dest, const char* source, size_t num);
int main(void)
{
char str[] = "Now let's see if memcpyX() function works correctly.";
char str2[80];
memcpyX(str2, str, strlen(str)+1);
printf("Str [1] content: %s", str);
printf("\nStr [2] content: %s", str2);
printf("\n\nDone?!");
}
void* memcpyX(char* dest, const char* source, size_t num)
{
while(num) { // while num is positive
*dest++=*source++;
num--;
}
}