我想要訪問位於頭文件'Header.h'中的結構中的變量New_Id
。這是正在從名爲MAIN.C如何從位於頭文件中的結構獲取變量?
Header.h
#ifndef HEADER.H
#define HEADER.H
#include <stdio.h>
#include <stdint.h>
typedef struct {
uint32 New_Id;
} IdType;
我想接取這個變量,以下列方式
#include <Header.h>
#include <stdint.h>
#include <stdio.h>
void Main (void) {
//code independent of the structure.-----
-----------------------------------//
//Now accessing the structure variable//
IdType.New_id =2;
}
分配給它從我的C文件「main.c中的值爲」交流文件中完成然而,由於某些原因,我不明白它一直說'Field New_Id無法解決'。它不會爲結構本身說這個。有人可以告訴我我在這裏做錯了什麼。
結構不具有變量,但字段(或成員)。 –