Activity 3.7.
Take a moment and think about the following:
- What was your main take-away from today’s class?
- What was the most confusing in today’s class?
printf()
is used to display a message to the screen. Example: printf("This will be displayed on the screen!");
\n
starts a new line. Example: printf("Hello!\nMy name is Petra!");
\"
, \'
. Example: printf("She said: \"Today it\'s Monday!\" ");
int i;
for (i=0; i<3; i++) {
printf("Hello! ");
printf("Hi!\n");
}
/* ... */
or by using //
. Example: int main(void) {
int i; /* This is a comment. */
/* This is also a comment. */
/* A comment
can go over
multiple lines.
*/
for (i=0; i<3; i++) {
printf("Hello! "); // This comment ignores the remainder of the line.
printf("Hi!\n");
}
}