Hello, world!
Discuss the following features of the sample program from lectures:
// Prints out a friendly message.
// Andrew Bennett <andrew.bennett@unsw.edu.au>
// 2017-07-24
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char *argv[]) {
// Print out the famous 'hello world' message.
printf ("Hello, world!\n");
return EXIT_SUCCESS;
}
- What is the purpose of the
\n
in"Hello, world!\n"
? - Comments:
- When can we use comments?
- What do comments tell us?
- What makes a good comment?
- How do comments improve program style?
- Indenting and white-space:
- What is indented in the sample program?
- Suggest why.
In the lab, try and write a version of this *hello world* program and run it.