How to Initialize char array from a string

后端 未结 11 2003
时光说笑
时光说笑 2020-12-14 09:19

I want to do the following

char a[] = { \'A\', \'B\', \'C\', \'D\'};

But I do not want to write these characters separately. I want somethi

11条回答
  •  一整个雨季
    2020-12-14 10:05

    This compiles fine on gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4).

    const char s[] = "cheese";
    
    int main()
    {
        return 0;
    }
    

提交回复
热议问题