我能够在Xcode的模拟器上构建React原生示例应用程序UIExplorer,但在设备上构建它会产生错误
#include<stdio.h>
#include<stdlib.h>
int main()
{
FILE *fp;
int count;
int i;
fp = fopen ("fruits.txt", "w");
if(fp == NULL)
{
printf("Can't open file!!");
exit(0);
}
fputs("4 Apple Banana mango berry", fp);
fclose(fp);*/
fp = fopen("fruits.txt", "r");
if(fp == NULL)
{
printf("Can't open file!!");
exit(0);
}
fscanf(fp, "%d", &count);
printf("%d\n", count);
fclose(fp);
char *fruits[count]; // This line is giving Segmentation fault.
return 0;
}
截图