error: must use "struct" tag to refer to type 'point'如何在C中實現一個帶有兩個浮點數的結構體?
我想要做的就是將座標存儲爲結構體。 這似乎非常簡單,但我不能在訪問20個網站並搜索Kernaghan的書後做到這一點。
我缺少什麼?
#include <stdio.h>
int main()
{
struct point
{
float x;
float y;
};
point.x = 0.0;
point.y = 1.9;
return 0;
}
你有一個* type *'struct point',但是你沒有這個類型的變量。 –
這只是一個建議,但如果您想在不同的函數中創建該結構的對象,則應該在主函數之外定義您的結構類型。 –