ECS 30 Lecture Notes - Lecture 7: Data Segment, Global Variable, Scanf Format String

30 views5 pages

Document Summary

Functions can have multiple arguments: useful if you want to compute calculations with user input variables that are present in the same formula, the arguments are used to calculate the variable you want to return. Scanf() and input detection: returns the number of tokens matched. Ie. what was entered: useful to impose a format in string input. Friday, 20 april 2018: local variables (black scope) Local block variables mask previously declared variables with the same name: the variable disappears the end of the block. Within the local block, access to previous declared variables is given, and they can be manipulated. Must be declared before use (same as functions) Usually de ned on top of le: do not rely on them too much (eg. for easy problems), as that gets you into a bad habit and can lead to mistakes in code. Scope restricted to function containing the declaration.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents