enter image description hereenter image description here


I am following along in week 1's second lecture, specifically trying to code capitalize0.c. Previously, all my coding files (cash, cash.c, hello, etc) were aligned with my bigger files, psest1 and pset2. I wanted to get organized, so moved all my code that belonged to pset1 and pset2.

This happened to me before when I already had code ready to run. Whenever I went into my terminal window and executed the "make" statement, it always outputed some error.

I tried searching for an answer in multiple places, but nothing relevant came up.

Thank you.

**Notice how the first picture has capitilize0.c as on it's own and the code runs (although it has errors, at least it runs!)

**On the second picture, capitilize.0 belongs to pset2 and it gives a "no rule error"...

  • You should not have any of the problems mentioned just by moving your files to another folder, another thing is to compile them, you should change to the directory that contains the files with the cd command, anyway it would be good to see what errors you get
    – MARS
    Jul 12 '18 at 19:19
  • Additionally, the colours are usually done based on the file extension. So if you actually saved that text with a .c extension, it should show up right. Sadly, you cut off the file name in the screenshot.
    – Blauelf
    Jul 12 '18 at 19:44
  • @Blauelf Thank you for the quick reply!! However, my file name is with the ".c" extension. Any other ideas as to why my code isn't running? (I exited the cloud and reopened it and now it's colored...) Jul 12 '18 at 19:57
  • I have now include my error and file name. Jul 12 '18 at 20:08
  • What @MARS said applies. You have to be in the directory where the file to compile is. The prompt shows you are in ~/workspace/ while the file is in ~/workspace/pset2/
    – Blauelf
    Jul 13 '18 at 5:02

In a for loop we have three well differentiated parts, the initialization, the end of cycle condition and the counter that changes the variable in each pass of the cycle, these three parts are flexible enough, and they are not all obligatory (you need to read a bit about it) ), in any case these three parts are separated by a semicolon. In your case it seems that in the part of the initialization you are separating the variables to be initialized with a semicolon, when the correct thing is to separate them with a comma:

for(int i = 0, n = strlen(s); i < n; i++)

You must log in to answer this question.

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