In C, you can use strcpy to copy strings.
The header file is string.h
// copy string in c strcpy(ch,n,p)
Example:
/* Example:copy string in C language */ #include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> #include <stdbool.h> #include <errno.h> int main() { char str1[9]="string1"; char str2[9]; char str3[40]; strcpy(str2,str1); strcpy(str3,"Hello lautturi world"); printf("str1: %s\nstr2: %s\nstr3: %s\n", str1, str2, str3); return 0; }