how to convert from char* to char[] in c

c, type-conversion

Solution

You'll have to use `strcpy()` (or similar):

...  
char c2[100];
strcpy(c2, c);

You can't assign arrays using the `=` operator.

Problem

here is a code sample ``` void something() { char c[100]; scanf("%s",c); char c2[100]=c; } ``` my problem is when i do this assignment an error says that i can't assign ``` char * "c" to char[] "c2"; ``` how can i achieve this assignment?

Original source