Connecting Tech Pros Worldwide Help | Site Map

c malloc help

Newbie
 
Join Date: Mar 2007
Posts: 1
#1: Mar 24 '07
I would be thankful for some help.
This is the structures that i use:

struct stackDef {
string oneWord;
struct stackDef *next;
};

typedef struct stackDef stack;

struct linkedListDef {
stack *stackInList;
struct linkedListDef *next;
};

typedef struct linkedListDef linkedList;

I have writen a program that reads words from a file ant puts them in to the list of stacks. Everything is working, but if the file i am reading from has a word of 10 or more characters, the program ends its work on the line

stackToList = malloc(sizeof(stack));

It doesnt give any errors or anything, it just stops. if all the words are less than 10 char's, the program works properly.
Thank you in advance.
Reply