Class Notes for Week Ending 11/6/09

By popular request, and since many of you have never seen a goto before, here is how to write a for loop using only if's and goto's:

#include <stdio.h>

int main( void )
    int i;
#if 0
    for (i = 0; i < 64; ++i) {
        printf ("%x\n", 0xdeadbeef >> i);
    i = 0;
    if (i >= 64) {
        goto loop_break;
    printf ("%x\n", 0xdeadbeef >> i);
    goto loop;
    return 0;

Also, here is a link to the latest (as of this posting) revision of the C99 standard:

It is the real McCoy and is more comprehensive than the K&R book, although less user friendly.

Back to top
blog/class_notes_for_week_ending_11_6_09.txt · Last modified: 2009/11/04 22:52 by jeffk