how to assign a value to a string array?

后端 未结 3 887
情深已故
情深已故 2020-12-19 19:25

for example

#include 
#include 
#include 

char substr[10][20];

int main() {
    substr[0] = \"abc\";

    pr         


        
3条回答
  •  感动是毒
    2020-12-19 19:42

    You can't assign strings like that in C. Instead, use strcpy(substr[0], "abc"). Also, use %s not %d in your printf

提交回复
热议问题