1 / 2

# Pointers and Arrays

Pointers and Arrays. int table [8]; int *ptr ; ptr = table ; table [ 4 ] = 94; *( ptr + 4 ) = 94; How about ptr = &amp; table[0] ?? vs. ptr=table ;??. 94. table. ptr. ( ptr + 4 ). Pointer Arithmetic. 0x5010 | a 0x5011 | b 0x5012 | F 0x5013 | H 0x5014 | X

Télécharger la présentation

## Pointers and Arrays

An Image/Link below is provided (as is) to download presentation Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

### Presentation Transcript

1. Pointers and Arrays int table [8]; int *ptr ; ptr = table ; table [ 4 ] = 94; *( ptr + 4 ) = 94; How about ptr = & table[0]?? vs. ptr=table;?? 94 table ptr ( ptr + 4 )

2. Pointer Arithmetic 0x5010 | a 0x5011 | b 0x5012 | F 0x5013 | H 0x5014 | X 0x5015 | Y Given the following pointer and array. char array[6]; char *ptr 1) Initialize the pointer ptr and make it point to the first element of the array? ptr = array; or ptr = & array[0]; 2) What are the values of the following? &array[0]? _________________ (ptr+ 3)? ___________________ array[0]?___________________ *(ptr + 3)?___________________ *ptr? ______________________ &array[3]?___________________ (*ptr)+2?___________________ array[3]?___________________ Array[6]

More Related