Good point - C was created specifically to design the Unix OS. Why anybody would design anything other than a compiler or OS with it is beyond me.
I'm still struggling with how to implement another function in this program. I apologize if I come across as argumentative. I'm frustrated with learning this language - and with myself because I can't pick it up as fast as I need to. Any help and suggestions you give are still greatly appreciated.
Code:
bool enterName(char* name, char** arrayOfNames, int numSlots) {
int m;
for(m = 0; arrayOfNames[m] != NULL && m < numSlots; m++){
printf("\nLooking through: %s\n", arrayOfNames[n]);
}
if(m == (numSlots - 1)) {
printf("\nArray is full! Stop trying to add stuff! %s won't fit!\n", name);
return false;
} else {
printf("\nFound a free spot to store: %s\n", name);
//arrayOfNames[m] = malloc(sizeof(name) + 1);
memmove(arrayOfNames[m], name, (sizeof(name) + 1) );
return true;
}
return false; // If you made it this far there was probably no name entered.
}
I'm trying to put this in the previous code with the methods - I did make modifications as suggested by Elysia. I get a compile error for the red line above in my newly attempted function.
Code:
24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘enterName’