0% found this document useful (0 votes)
34 views1 page

Pointers Review

The document discusses pointers and arrays. It explains how to declare a variable assigned to a dereferenced pointer before the actual pointer assignment. It also discusses how pointers can replace the content of a variable if the pointer is set to a new value. The document describes using pointers as a substitute for accessing and modifying arrays.

Uploaded by

yoyoyo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views1 page

Pointers Review

The document discusses pointers and arrays. It explains how to declare a variable assigned to a dereferenced pointer before the actual pointer assignment. It also discusses how pointers can replace the content of a variable if the pointer is set to a new value. The document describes using pointers as a substitute for accessing and modifying arrays.

Uploaded by

yoyoyo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Arrays.

 Declare the variable which is not a pointer in assignment = to dereferenced variable BEFORE the
ACTUAL pointer = to the variable where it will get its value from.
ptr = &num1;

*ptr = num1;

 Pointers can replace the content of a chosen variable as long as the actual pointer is set to
another value;

int num = 1 = 250, num 2 = 50;

ptr = &num1;
*ptr = 1250;

num1 would print 1250, num 2 would print 50.

 You can use pointers as a substitute of accessing, modifying arrays.

int age[] = {17, 23,};

*age;

 In order to use a pointer in an array and modify the data inside it using a for loop: follow the
syntax:
*(array_Name + identifier);

You might also like