I am having a bit of difficulty trying to effectively kill two birds with one loop. I have cropped the below code to focus on my trouble area. I'm trying to combine what would be two different loops into one. Theoretically, it makes sense that I should be able to do this. However, being new to all of this, I'm essentially clueless. I've had this functioning as two different loops. Each of those reflected in the comments of the code itself.

My primary error comes in the form of an 'undeclared identifier'[j] highlighted in the screen-grab below. I have parsed the walk-through and numerous online forums for something relative, but remain scratching my head as I believe that it is declared in the for loop above it. Any assistance with this would be greatly appreciated. I'm sure that this is silly.

enter image description here


The correct way isif(argc !=2 || ! isalpha(key[j]))

  • MARS is correct. You're trying to call the function isalpha(), but without the parentheses and parameters inside them, it looks like a variable name, which was not previously declared. Also, FYI, note that the compiler results will point at exactly the problem code. I suspect that your results pointed at isalpha, not key[j].
    – Cliff B
    Apr 16 '16 at 19:28
  • Thanks for the follow up, Mars & Cliff B. Unfortunately, while helpful, this still didn't rectify the error message. I should have mentioned that I tried various syntax within that loop, including but not limited to your suggestion. I have provided a further grab exampling the error in question. dropbox.com/s/v2uc9wp2cnrxbxy/…
    – Marty
    Apr 17 '16 at 16:16
  • watch the semicolon in your condition IF and the FOR loop, this is incorrect, delete them. The semicolon is a way to end a sentence, but in a loop that does not work well, either in an if condition. A review of the theoretical part of the loops help you
    – MARS
    Apr 17 '16 at 17:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .