Syntax Flashcards
How do you add a comment to your code?
With ‘//’ you can add a comment
Where must an escape sequence be located?
Within the double quote of a string
How do you add a block comment to your code?
With ‘/*’ and a closing */ you can add a block comment
What are some rules to variable naming?
- Names can include upper or lower case letters, numbers, and underscores
- The first character must be a letter
- No keywords are allowed as the full name
What does the ‘int’ variable type hold?
Whole numbers from -2.1 billion to 2.1 billion
What does the ‘float’ variable type hold?
Numbers with possible decimal value (up to 6 decimal places)
What does the ‘double’ variable type hold?
Numbers with possible decimal value (up to 15 decimal places)
What does the ‘char’ variable type hold?
One letter or number
In printf double quotes what does %d and %i display?
Integers
In printf double quotes what does %f display?
Double or Float
In printf double quotes what does %c display?
Character
In printf double quotes what does \n cause?
A newline
In printf double quotes what does \r cause?
A carriage return
In printf double quotes what does \t cause?
A tab
What does a character need around it if you are declaring the value of a variable on the same line?
Single quotes: ‘a’