char array not assignable

后端 未结 4 1036
陌清茗
陌清茗 2020-12-19 17:26

Okay, so I want to save a word in a char array but it gives me a error

Here\'s my code

#include 
#include  
#i         


        
4条回答
  •  春和景丽
    2020-12-19 18:32

    switch class = "Warrior"; to strcpy(class, "warrior");

    switch class = "Mage"; to strcpy(class, "Mage");

    switch class = "Ranger"; to strcpy(class, "Ranger");

    switch class = "undefined"; to strcpy(class, "undefined");

    and it should work !

提交回复
热议问题