type conversion - how to convert from char* to char[] in c -


here code sample

void something() {    char c[100];    scanf("%s",c);    char c2[100]=c; } 

my problem when assignment error says can't assign

char * "c"  char[] "c2"; 

how can achieve assignment?

you'll have use strcpy() (or similar):

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

you can't assign arrays using = operator.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -