Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
problem with freeing data
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="david, post: 3466559"] The is not that small and I will post in the one of pastebin websites. stack.h - [URL]http://www.paste.lt/paste/6aa50aa1d92f58faaf56c8d24e3f1f16[/URL] stack.c - [URL]http://www.paste.lt/paste/684c6fa2ef499d9fab2d4be11c65e796[/URL] antra.c (main) - [URL]http://www.paste.lt/paste/0f2dd328b28e561a6c0383ad9fb41cdf[/URL] antra_lib.c - [URL]http://www.paste.lt/paste/83ec85cface8e1215055f7acc4d106f0[/URL] antra_lib.h - [URL]http://www.paste.lt/paste/cc88b47394767fc242edd6edf9487b4c[/URL] I am sorry that I am not using buffered reading in this program. This is the hole program and you should be able to compile it. ../antra <source_file> <destination_file> <separators_list_file> should put words in destination file whose length is even (sorry if wrong word, my native language is not English) and word does not contains any number. I use realloc to allocate memory and grow my string until I get to separator and when I push to stack the pointer of this string and then I NULL the pointer and reseting the length of string back to zero, this should protect the later string I created. And again I reallocate a new one and etc. till the end. Stack struct has pointer "root" which points to the top of my stack. child struct contains of next pointer (next item in the linked list) and char pointer there it holds the location of the string I pushed. I again read how works realloc and I can see that I should be using it correctly, if pointer is NULL when realloc works just like malloc. I am very interested why I can not free that string later after poping it from stack. Thanks everyone for helping. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
problem with freeing data
Top