1
프로그램을 실행하고이 코드 집합의 구조에 대한 데이터를 입력 할 때 입력하려는 데이터로 1을 입력하면 항상 오류가 발생합니다. 다시 같은 숫자를 입력해도 작동하는 것 같습니다. 나는 코드의이 부분이되도록 그것을 분리했다.유효성 검사 오류가 항상 먼저 발생합니다.
아무도 도와 드릴 수 있습니까?
do{
puts("What is the packet type?");
if(scanf(" %d", &records[*rCount].type) == 1
&& records[*rCount].type >= 0
&& records[*rCount].type <= 10)
{
valid = 1;
}
else
{
valid = 0;
getchar();
puts("\nNot a valid input");
}
}while(valid!=1);
구조 정의 :
struct packet{ // declare structure for packet creation
int source;
int destination;
int type;
int port;
char data[51];
};
구조가 어떻게 달라졌습니까? – rullof
구조체로 업데이트 됨 – user3103598
'records []'표시 – chux