Introduction to C Programming - Exercises

Chapter chap1 section 10

  1. Your first task, of course, is to enter, compile and run the hello world program on your computer system. Note the commands you used to compile the program, any messages produced and the names of any files generated.

  2. Now try some of the programs with errors. Note the error messages produced by your compiler. Do you think they are more infomrative than those described in the notes ?

  3. What is the effect of typing the hello world program using round brackets (parentheses) rather than curly brackets (braces) ?

  4. Write a C program that produces the following output

    	****************
            *  hello world *
    	****************
    

    using multiple printf() calls.

  5. Write a C program that prints hello world vertically on the screen.

  6. Write a C program that prints hello world on the screen and then "beeps".

  7. On many displays the character sequence ESC [ 2 J causes the display to go blank. Use this information to write a C program that clears the screen. (If you are working on a PC running MSDOS you'll need to ensure that ANSI.SYS is operational)

  8. Write a program that displays hello world in the centre of an otherwise blank screen.