MAT 21B Lecture Notes - Lecture 18: Entry Point, Null Character
Lecture 18
Announcement: study for midterm
Extra office hours
See on canvas for more announcement over weeked
String formatting
- Instead of printing sprint() stores the formatted string in a character array
o Access to same placeholder
o Array must be large enough
o Wont understand if lower than limit size
2D array
- 2d array is complete and stored in one block in memory
o Possibly waste a lot of space
- Function needs to know the number to characters per entry – max limit
- Size of each sting is properly evaluated because of explicit null character
Array of pointers
- Array of pointers, pointing on the string
o String can be located anywhere in memory
o Stored in memory C
o Strings are just the right size
▪ Follows the character limit
Command lines (argument)
- Argc contains the number of command line argument
o Including name
o Argv is array of pointers to strings, for each argument
find more resources at oneclass.com
find more resources at oneclass.com
beigecamel74 and 41 others unlocked
83
MAT 21B Full Course Notes
Verified Note
83 documents
Document Summary
See on canvas for more announcement over weeked. Instead of printing sprint() stores the formatted string in a character array: access to same placeholder, array must be large enough, wont understand if lower than limit size. 2d array is complete and stored in one block in memory: possibly waste a lot of space. Function needs to know the number to characters per entry max limit. Size of each sting is properly evaluated because of explicit null character. Array of pointers, pointing on the string: string can be located anywhere in memory, stored in memory c, strings are just the right size, follows the character limit.