I am super lost. You see when I'm at school I like to write functions about what I want to do when I get home. Well I was creating a sorting function that sorts an array of strings, it doesn't work just yet. Well, there's no C compiler here, and I was wondering if someone could help me out if I have concept problem with what's going on with this code:
I've never used memcopy before lol, and it just looked right at the time. I highlighted the parts where I have no idea in red. Could you tell me what I'm doing wrong? Why it wouldn't compile correctly?Code:#include <stdio.h> char **sortAll(const char *sortThis[255], const int nTotal) { char *szSorted[255] = malloc(nTotal * sizeof(*szSorted)); strcpy(szSorted[0], sortThis[0]); return szSorted; } int main(void) { const char *szNotSorted[] = { "abc", "def" } char **szSorted; memcopy(szSorted, sortAll(szNotSorted, 2)); puts(szSorted[0]); /* Hoping 'abc' :) */ return 0; }