Day 40: Getting cozy with loops and C

November 18, 2015 Will Lam

day 40 loops

So you might have noticed a big jump in terms of the days.  I decided to take into account the passage of time since my last real update before a bit of a setback. If I was to be honest with myself, I’m on Day 40 of my weekday updates (not including weekends).

In the meantime, I’ve been getting cozy with the programming language C, which serves as the foundation for Objective-C. While I have been studying the Absolute Beginner’s Guide to C Programming, I haven’t shared what I’ve been working on.

I’m not going to cover the rudimentary stuff I’ve been working on before, but I will cover the stuff I’m learning in C as of today, specifically Loops and the forms it comes in.

This is just a simple For Loop that counts up over a series of events and prints out the names of events. In this case, there’s only 5 events.

This is the stuff I’m going through as I’m learning loops in C. The output is that it counts up from 1 to 5 and then back down to 1 again:

#include

int main ()

{

int counter = 0;

while (counter < 5) { printf(“Counter is at %d. (going up)\n”, ++counter); } while (counter > 1)
{
printf(“counter is at %d. (going down)\n”, –counter);
}

return 0;
}

Previous Article
Day 43: Revisiting Foundations
Day 43: Revisiting Foundations

Not much to write about or anything earth shattering. Today I’m not going to share code because while going...

Next Article
Switching from Swift to Objective-C. A short hiatus, but still here
Switching from Swift to Objective-C. A short hiatus, but still here

So it’s been a while since my last real post. Some stuff happened, but I’ve slowly been able to get back to...