basic string copying in c
#include "stdio.h" #include "string.h" #include "stdlib.h" //string examples for c int main(void) { const char* a = "foobeans"; int len = strlen(a); char* b = malloc(len); strcpy(b, a); puts(b); return 0; }