Hi everyone. I'm currently designing a dynamic array which will hold strings of length 0 to 1024. I have finished all of the methods except for the method that sorts the dynamic array in order from lowest to highest (ASCII value). I cannot, for the life of me, get this qsort() to work. I have tried for several hours to get it to work. I think it has to do with the fact that I am qsort'ing a 2d array whereas the library is designed to qsort a 1d array. Here is a copy of some of the code I am using. If you need more info, just let me know. Please help ASAP! Thank you! Code: (structure definition in header file) typedef struct darray{ char (*primarray) [1024]; int capacity; int size; } darray; (in c file) void da_sort(darray *da){ /* The qsort function */ qsort(da->primarray, 1024, sizeof(char), compare_chars); } int compare_chars(const void* a, const void* b) { /* the compare function to go with qsort*/ char* arg1 = (char*) a; char* arg2 = (char*) b; if( *arg1 < *arg2 ) return -1; else if( *arg1 == *arg2 ) return 0; else return 1; }
I won't read your code because of the lousy formatting engendered by your failure to read and apply the "Before you make a query" thread. I'm sure the administrator will ultimately fix it, but I will continue to bear in mind your rudeness when seeking a free, voluntary reply.
I did not ever intend to be rude to anyone. Sorry if I didn't follow a rule, I am kind of in a rush today and I didn't really have time to read all of the rules. But, I would prefer to get help from someone who doesn't make an effort to go on forums on their Friday afternoon and harass people who may not know any better. If anyone is being rude here, it's you. Thanks for nothing. Hope someone with a kinder soul would enlighten me as to what I can do to make this easier and to get some help on this. Again, if I broke a rule i will gladly try to fix my problem, just make me aware of it instead of being an ***.
No, it is rude of anyone to pop into a new environment and not observe or check out how things are expected to work. Do you fart in a church the first time you visit, or wait to see if it's the norm? Even now, if you had read the "Before you make a query" thread, you would be wiser, rather than just a wiseass on a self-entitlement binge.
Actually, I came on here to get help. I think the wiseass on the self-entitlement binge is the person who spends all day scouring these forums in a sad attempt to enforce the fine print. Comparing asking a question in a QUESTIONS forum to farting in a church is borderline retardation...well, that's not surprising for someone of your caliber, is it? I figured out my problem on my own. I almost feel sorry for you...seeing as you have absolutely nothing better to do than harass people for 'disobeying' the rules. Give me a break! Here's an idea: stop hanging around forums all day harassing people and get a social life. And no, talking on forums doesn't count. What a complete waste of my time and energy. If you are a sample of what the community is like on these forums then I would rather lodge a barbed, acid tipped, red hot rusty nail in my eye than spend another minute of my life here.