EE 200 Lecture 6: More on arrays and pointers Steven Bell 23 - - PowerPoint PPT Presentation

ee 200 lecture 6 more on arrays and pointers
SMART_READER_LITE
LIVE PREVIEW

EE 200 Lecture 6: More on arrays and pointers Steven Bell 23 - - PowerPoint PPT Presentation

EE 200 Lecture 6: More on arrays and pointers Steven Bell 23 September 2019 Copying strings (PollEverywhere + discussion) Const and strings Why does this crash? void fixString(char* str) { str[0] = 'U'; } int main(int argc, char*


slide-1
SLIDE 1

EE 200

Steven Bell 23 September 2019

Lecture 6: More on arrays and pointers

slide-2
SLIDE 2

Copying strings

(PollEverywhere + discussion)

slide-3
SLIDE 3

Const and strings

Why does this crash? void fixString(char* str) { str[0] = 'U'; } int main(int argc, char* argv[]) { char* cucumber = "I like cucumbers."; fixString(cucumber); }

slide-4
SLIDE 4

Const and strings

What happens now? void fixString(char* str) { str[0] = 'U'; } int main(int argc, char* argv[]) { const char* cucumber = "I like cucumbers."; fixString(cucumber); }

slide-5
SLIDE 5

Const and strings

What happens now? void fixString(const char* str) { str[0] = 'U'; } int main(int argc, char* argv[]) { const char* cucumber = "I like cucumbers."; fixString(cucumber); }

slide-6
SLIDE 6

Grading

You should be able to see your results for classwork 3

slide-7
SLIDE 7

tmux

tmux lets you have multiple terminals over an SSH session tmux Start tmux tmux attach <Ctrl>B, then d Reconnect to an existing tmux session Disconnect but leave session running <Ctrl>B, then % Split horizontally (side by side) <Ctrl>B, then " Split vertically <Ctrl>B, then <arrow key> Move between panes

slide-8
SLIDE 8

Classwork 6 is hosted on Github

Code should be submitted on Gradescope by class time (4:30pm) next week (10/3). You will submit directly from Github, not by uploading a zip. You have your own repository for this assignment; find the URL by going to your Github page.