顺便说一下,我使用 CLion。
int ch;
printf("Insert the operation you want to execute: ");
scanf("%d", &ch); //HERE
Run Code Online (Sandbox Code Playgroud)
我将 ch 声明为一个整数变量,并使用scanf和%d并且我希望用户插入一个值以插入到 ch 变量中,但是这里会弹出一个警告并说:“‘scanf’用于将字符串转换为整数值”
我不明白为什么...
这是完整的代码,如评论中所要求:(代码被修改,因为我从昨天开始更改了它)
typedef unsigned int boolean;
struct list{
float * buffer;
int size;
int head;
int tail;
};
int getsize();
float getvalue();
void init(struct list*, int);
boolean suf_insert(struct list*, float, int);
boolean pre_insert(struct list*, float, int);
void visit(struct list*);
int main(){
struct list listA;
struct list listB;
int size=0;
int ch;
while(1){
printf("Sequential Lists operations\n"); …Run Code Online (Sandbox Code Playgroud)