#include <stdio.h>
#include <string.h>
#include <stdbool.h>
int main(int argc, const char * argv[]) {
bool isTrue=true;
int nums[50];
for (int i = 0; i<sizeof(nums); i++) {
nums[i]=2147483647;
}
char operations[49];
int counter = 0;
printf("What is your first number? (THERE IS NO PEMDAS, THE NUMBER 2147483647 is not allowed)\n");
scanf("%d", &nums[counter]); // Thread 1: EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
我有更多代码,但是与问题无关。感谢您的帮助,只是问是否需要更多信息(我正在制作一个可以对输入进行排队并对其进行计算的计算器例如。 3 + 5 * 9/2 =36。该方程式最多可以包含50个整数和49个运算。)
您正在以字节为单位而不是元素数量来计算数组的大小。改为执行此操作: