1 / 4

Consider the assignment statement:

Consider the assignment statement:. int a[] = {1 , 2, 3, 4 , 5}; What is the value of a[2]? (A) 3 (B) 2 (C) 4 (D) [2, 4, 6, 8, 10] (E) This produces an error. Which of the following are the same?. int foo [3]; foo * foo foo [0] & foo --- A & B B & C C & D

finley
Download Presentation

Consider the assignment statement:

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Consider the assignment statement: int a[] = {1, 2, 3, 4, 5}; • What is the value of a[2]? (A) 3 (B) 2 (C) 4 (D) [2, 4, 6, 8, 10] (E) This produces an error.

  2. Which of the following are the same? intfoo[3]; • foo • *foo • foo[0] • &foo --- • A & B • B & C • C & D • They're all the same • They're all different

  3. How many memory locations are reserved for this array? intfoo[3][4]; • 3 • 4 • 7 • 11 • 12

  4. What gets printed? char foo[] = "hello, world!"; printf("%c%c%c", foo[2], foo[4], foo[7]); • "el_" • "loo" • "low" • "lol" • This causes a crash

More Related