how to assign a value to a string array?

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

for example

#include 
#include 
#include 

char substr[10][20];

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

    pr         


        
3条回答
  •  梦毁少年i
    2020-12-19 19:45

    Hope this helps:

    void main(void)
    {
        char* string[10];
        string[0] = "Hello";
    }
    

    Otherwise I think ya need to copy it by hand or use strcpy or the like to move it from one block of memory to another.

提交回复
热议问题