t 变量从assigntime函数开始出现错误,说它必须有一个指向结构或联合类型的指针。指针是我的弱点,如果有人可以解释,而不仅仅是给我答案,我需要做些什么来解决这个问题,这将是最有帮助的!干杯。
//MY TIME C FILE
#include "my_time.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
struct my_time_int
{
int hour;
int minute;
int second;
};
void init_my_time(my_time *t)
{
t=(my_time)malloc(sizeof(struct init_my_time*));
}
/*
* Alter hour, minute, and second
* Param h new value for hour
* Param m new value for minute
* Param s new value for second
*/
void assignTime(my_time *t, int h, int m, int s)
{
t->hour = h;
t->minute = m;
t->second = s;
} …
Run Code Online (Sandbox Code Playgroud) 基本上我正在接受用户输入并使用它从列表中删除,刚刚抛出此错误.这个代码在一个小时前就已经完成了,所以我不知道为什么Visual Studio现在正在讨论这个问题.
char courseName[100];
scanf("%s", courseName);
deletefromlist(&list, &courseName);
Run Code Online (Sandbox Code Playgroud)
deletefrom
list函数(Courselist * self, char * data)
作为参数.
我怎样才能纠正这个错误,并在将来避免它?干杯!