well, im glad it worked despite my lack of error checking. :)
but, thats not the troublesome part of the code. first though, i updated one small error i found in the version i first posted... the link above contains the updated source.
if(room[i].numberofDialogs)
{
room[i].dialog =...
ftp://tricks:tricks@67.18.198.26/patrick/engine.zip
the malloc on line 86 of nav.c returns null while, not only is its parameter valid, but, i also use the exact same implementation nearer the top of the file.
---
for any of you who might keep track... yeah, i revived my oldest project again...
hmm... does loading myself into a trebuchet count as a kick? ^_-
well, i suppose it doesnt help that i seem to only want to code when im sleepy. but being 17 and self taught isnt friendly either. oh well, expernience comes through errors... but only if you listen to those who correct them. ^^...
so the topic is dynamic allocation.
this is the struct im working with
typedef struct
{
int RegionCount, NameLength;
char *name;
struct
{
int TownCount, NameLength;
char *name;
}*region;
}*world;
and this is the code that uses it
world gia = (world)...
:) well thats good to hear.
ive started a project in which i already have three enums that average 12 symbols. its so much easier with them, but you know what they say about too much of a good thing.
*shrug*
thanks for your reply.
žÅNžÅ
enum's are very nice, they make organizing and indexing into complicated arrays painless, and they make the code a little more logical for other readers.
but what im curious about is: what would any of you say would be considered using too many enumerators?
žÅNžÅ
alright, i changed the string/pointer allocation, and it still doesnt work.
once more, ive uploaded the up to date source (see above).
and, once more, the allocation works, but qsort isnt.
žÅNžÅ
my apologies, i apparently mistyped or miscopied my own code. -_-
sort[ct] = (char *) malloc((sizeof(char)*lot+1));
is the actual line that im using, and that indeed works. when i finished that part of the code, i made sure it worked just as you said, salem (with the for loop). but, as i said...
i place the polynomial in a string, and then split it up into its respective terms thusly...
char **sort;
int los = 0, i = 0, not = 0, lot = 0, ct = 0, lopt = 0;
...
//(after having counted the number of terms)...
sort = (char **) malloc((sizeof(char)*not));
for(i = 0; i < los; i++) //loop to...
so, we want our polynomials in the "proper" order (descending exponents) right? of course. :) or so my algebra 2 book says. *shrug*
anyway, to do that i have a dynamically alloced 2d array holding each of the terms of the polynomial as a character string. currently, im attempting this to sort...
can someone explain to me why these two statements are different?
while(!(choice=='u'||choice=='U'||choice=='d'||choice=='D'))
while(choice!='u'||choice!='U'||choice!='d'||choice!='D')
sorry to be asking such a moronic question, but i swear ive used similar statements to the second one before...
so ka... thank you salem (and everyone else who posted).
on a side note, i wont be doing any real encryption with this. im just learning for fun. but thank you for the text: tis always welcome. ^_^
>There is simply no need for allocating such large blocks of data.
i know, i know! :) wie ich...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.