This code runs without problems on VS6, but crashes on VS2005 (I've just started to use VS2005)
Please WHY??
Code:#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { int iCode; char *pName; double dPrice; } Products; struct Node { Products products; struct Node *pNext; struct Node *pPreview; }; void AddNodeHead (struct Node **pNode) { struct Node *pTemp; puts("Adding node"); pTemp=malloc(sizeof(Products)); puts("Done!"); if (pTemp==NULL) { puts("Failed to allocate!"); // Delete All exit(1); } pTemp->pNext=*pNode; pTemp->pPreview=NULL; if (*pNode) (*pNode)->pPreview=pTemp; *pNode=pTemp; } int main ( void ) { struct Node *pHead=NULL; int i; for (i=0;i<3;++i) AddNodeHead(&pHead); return 0; }