Skip to main content
Logo image

Section 3.7 Summary

Activity 3.7.

Take a moment and think about the following:
  1. What was your main take-away from today’s class?
  2. What was the most confusing in today’s class?
Here is what we have learned:
  • 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!");
    
  • Quotation marks need to be "escaped", as in: \", \'. Example:
    printf("She said: \"Today it\'s Monday!\" ");
    
  • Loops are used to repeat instructions multiple times. Example:
    int i;
    for (i=0; i<3; i++) {  
        printf("Hello! ");
        printf("Hi!\n");
    }
    
  • Comments are important throughout your code. Comments can be included in your code by enclosing them in /* ... */ 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");
        }
    }