#include<stdio.h>
#define msize 4096
struct memory
{
int a[msize];
};
void main()
{
struct memory m;
m.a[0]=250; // temperature value of 25,0
m.a[4]=01; // heater status OFF
m.a[8]=240; // temperature value of 24,0
m.a[12]=00; // heater status ON
m.a[16]=220; // temperature value of 22,0
m.a[20]=00; // heater status ON
read(&m);
}
void read(struct memory m)
{
int i;
for(i=0;i<sizeof(msize);i++)
{
scanf("%d", m.a[i]);
}
}
내 코드는 구조체의 개체 인 크기 4096 바이트의 구조체를 만든 다음 값을 i에 할당합니다.C에서 구조체의 값을 읽는 방법
컴파일시 컴파일러에서 read
함수에 "first defined here"오류가 발생합니다.
또한이 누군가를이 읽기 값을 ASCII로 변환하는 데 도움을 줄 수 있습니까?
을있을 때 오류 - 컴파일러가 질문에 표시해야합니다. – sje397
'sizeof (msize)! = 4096' 그리고'sizeof (struct memory)! = 4096' 그리고 void read (struct memory * m)'// arg 포인터를 읽는다 – BLUEPIXY