Context Matters
This is a quick whole class activity, not a group one. ['Prof. Melissa'] will be at the board to talk through this one.
Random Character in a File, Part 1 a “-” sign.
Suppose someone says to you, “I'm looking at a C++ source file and I see a - character. Can you tell me what it might signify?”
Is that enough context to give a definitive answer?
As a group, ponder the question: In code, what does the “-” sign mean?
- If the answer is, “it depends”, depends on what?
Random Character in a File, Part 2 a “&” sign.
Similarly, suppose someone says to you, “I'm looking at a C++ source file and I see a & character. Can you tell me what it might signify?”
Terminology
Notice some different C++ contexts:
| Code | Context |
|---|---|
int x = 42; |
declaration (and definition) |
setupFarm(3); |
statement |
a + b |
expression |
x = a; |
assignment |
Context Matters
Explain why each of these bits of code is nonsensical:
"mint" x = 42;setupFarm(int);a +
(When logged in, completion status appears here.)