On an IRC channel I'm a member of, one particular person mocks every piece of code I post, even if it's a rough draft or if I haven't coded in months. I am pretty well versed with computer theory and knowledge, but my skills with programming lack due to little practice. This particular code was from a project I was starting and I was putting down some ideas/structure on GitHub, when he pointed out this particular snippet.
So, after a couple months of trying to get the discipline to start coding again, I coded this and my question is: If indenting like this is bad, what other things did I do wrong here, assuming the logic is sound (I never tested it, I went on hiatus)? Also, what would you do to avoid the indenting?
void parse_arguments(int count, char * arguments[]){//probably add file pointer here to pass to load, change return type when an API is decided.
int currentArg, paramIndex;
for(currentArg = 1; currentArg <= count; currentArg++){
if(arguments[currentArg][0] == '-'){
for(paramIndex = 0; paramIndex < PARAMMAX; paramIndex++){
if(strcmp(arguments[currentArg][1], arglist[paramIndex]) == 0){
switch(paramIndex){
case 0:
//load(currentArg + 1);
currentArg++;
break;
default:
break;
}
break;
}
}
}
}
}
Note: arglist
is a statically declared array of chars.