C, dynamically memory allocation
0. 1. strcpy() function #include <string.h> char* strcpy(char* destination, const char* source); 2. Allocating Memory dynamically: (1) void* malloc(int num); #include <malloc.h> int *p = (int*)malloc(n * sizeof(int)); // cast void* to int*, and the memory is not initialized if (p!= NULL){ /* allocation successful */} else {/*allocation fails*/} free(p); // memory leak if not free (2) void* calloc(size_t num, size_t size); #include <stdlib.h> int *p = (int*)calloc(n, sizeof(int)); // total allocated bytes are n*sizeof(int) if (p!= NULL){ /* allocation successful */} else {/*allocation fails*/}