【发布时间】:2017-05-16 12:24:13
【问题描述】:
我多次尝试修复错误“Incomplete Definition of Type of struct *,请您帮我找出问题并解决它吗?
对此有何建议?
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>
struct mypoint;
typedef struct mypoint {
int x;
int y;
};
void setRandomPoint(struct mypoint *a, int min, int max)
{
do {
a->x = rand();
} while (a->x > max || a->x < min);
do
{
a->y = rand();
} while (a->y > max || a->y < min);
}
int main()
{
struct myPoint point;
int min = 0, max = 0;
int i;
srand(time(NULL));
while (min >= max)
{
printf("Enter min:");
scanf("%d", &min);
printf("Enter max:");
scanf("%d", &max);
}
for (i = 0; i<5; i++)
{
setRandomPoint(&point, min, max);
printf("%d. point.x=%d, point.y=%d\n", i + 1, point.x, point.y);
}
printf("Finish.\n");
return 0;
}
请任何人都可以帮助我吗?
【问题讨论】:
-
您没有在代码周围添加具体的语句,只是句子,所以 SO 会让您发布。您应该发布错误、在哪一行以及您尝试修复它的原因。
-
struct myPoint point->struct mypoint point. -
如果您的问题得到解决,请考虑接受答案。
标签: c visual-studio-2015 struct