当我尝试打印expectedRuntime 变量时,它会打印expectedRuntime 的地址。但我可以正确打印 timeOfSubmission 变量。谁能帮帮我?
struct process
{
int timeOfSubmission;
int remainingRunTime;
int expectedRunTime;
char processName[20];
};
int main()
{
FILE *myInput;
myInput = fopen("input.txt", "r+");
while ( !feof(myInput) )
{
struct process * newProcess=(struct process *)malloc(sizeof(struct process));
fscanf(myInput, "%s", newProcess->processName);
fscanf(myInput, "%d", & (newProcess->expectedRunTime) );
(newProcess->expectedRunTime)=(newProcess->remainingRunTime);
fscanf(myInput, "%d", & (newProcess->timeOfSubmission) );
printf("%s ",newProcess->processName);
fflush(stdout);
printf("%d ",newProcess->expectedRunTime);
fflush(stdout);
printf("%d \n",newProcess->timeOfSubmission);
fflush(stdout);
}
return 0;
}