그래서이 코드포인터를 배열로 사용 하시겠습니까?
int *userInput; //array place holder
//int max; //Max variable for later use in comparisons
int start = 0; //inital starting point value for loops
int endUserInput; //used to find the total number input
printf("You may enter up to a max of 50 integer values, Please enter the first value: ");
//loop collects the user inputs
/* Using a while loop to check for data to be true in what is entered
to spot when the data becomes false when a letter is entered*/
while (scanf("%d", &userInput[start]) == 1) {
//If statement entered to catch when the total is met
if (start == 49) {
break;
}
start = start + 1;
//Print statement to let user know what value they are at and how to end input
printf("Enter next value %d or enter C to calculate: ", start + 1);
}
가 IT 메모리 오류로 충돌 PC에서 내 MBP 컴파일러에서 실행하지만 데브에 있나요? 오류가 int *userInput
신고입니다. 배열에 특성을 지정하지 않고이 문제를 해결하려면 어떻게해야합니까?
'userInput'에 대한 메모리를 할당해야합니다. – jxh
오류 메시지에 대해 자세히 알려주십시오. –