🎧 New: AI-Generated Podcasts Turn your study notes into engaging audio conversations. Learn more

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Full Transcript

This is CS50 Week 2 Carter Zenke Preceptor [email protected] Today Compilation Arrays Strings Command-line Arguments Problem Set 2 Compilation int main(void) { print("Hello"); }... main: # @main.cfi_startproc # BB#0: push %rbp.Ltmp0:.cfi_def_cfa_offset 16...

This is CS50 Week 2 Carter Zenke Preceptor [email protected] Today Compilation Arrays Strings Command-line Arguments Problem Set 2 Compilation int main(void) { print("Hello"); }... main: # @main.cfi_startproc # BB#0: push %rbp.Ltmp0:.cfi_def_cfa_offset 16... 01111111010001010100110001000110 00000010000000010000000100000000 00000000000000000000000000000000 00000000000000000000000000000000 00000001000000000011111000000000 00000001000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 Arrays H L 1 4 E 1 O 1 L 1 H E L L O 4 1 1 1 1 H E L L O 4 1 1 1 1 8 points 7 8 6 8 7 night1 night5 7 night3 8 6 night2 night4 8 7 nights 7 8 6 7 8 nights 7 8 6 7 8 nights 7 8 6 7 8 nights 7 8 6 7 8 nights 7 8 6 7 8 0 1 2 3 4 nights 7 8 6 7 8 Name nights 7 8 6 7 8 Size nights 7 8 6 7 8 Type int nights; int nights = {7, 8, 6, 7, 8}; Doubling Up Create an array of integers in which each integer is 2 times the value of the previous integer. The rst element is 1. Print the array, integer by integer. fi Strings H E L L O 4 1 1 1 1 8 points phrase H E L L O phrase H E L L O phrase H E L L O phrase H E L L O Character Integer A 65 B 66 C 67 … … phrase H E L L O phrase 72 69 76 76 79 Alphabetical Write a program to check if an array of characters is in alphabetical order. Assume the characters are all uppercase. Command-line Arguments $./mario H: 8 $./mario H: 8 int main(void) { int height = get_int("H: "); } $./mario 8 $./mario 8 int main(int argc, string argv[]) { } argv Write a program that prints each command-line argument given to the program This is CS50 Week 2

Use Quizgecko on...
Browser
Browser