我对使用Code :: Blocks(版本12.11)进行C语言编程有点新手,这个学期在我的大学开始,但是我管理着.
我最近在课堂上学到了关于指针,内存分配和动态数组(没有一个是我的强项),我将它们合并到我的程序中(并编译)
现在问题出现在我运行程序并进入菜单 - >添加产品时,程序在我输入价格时终止,并且我收到"流程返回-1073741819(0xc0000005)".我做了一些研究,发现它是一个访问冲突,但我真的不明白如何纠正它.
问候
这是代码:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define maxCharName 64
#define maxCharUserPass 8
#define maxCharId 5
// Product Structure
typedef struct{
char name[maxCharName];
char idCode[maxCharId];
float price;
float stock;
}product;
// DataBase of Products
typedef struct{
int sizeT;
product *array;
} TProducts;
TProducts a;
// Press any Key on the Keyboard to Proceed
void pressKeyToContinue(){
puts("\n\n\n Please Press any Key to Continue...");
getchar();
}
// Start Page
void startPage(){
puts("\n\n\n -- Welcome …Run Code Online (Sandbox Code Playgroud)