



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An introduction to pointers in c programming, explaining how they use memory addresses as values, the difference between pointers and ordinary variables, pointer operations, output parameters, pointers and arrays, structures with pointers as values, and dynamic memory allocation using malloc and free functions.
Typology: Study notes
1 / 6
This page cannot be seen from the preview
Don't miss anything!




Integer variable
int mint
Double variable
double xval
Character variable
char ch
int * mptr
location of an int
Address
Contents
int * mptr
-^
*mptr
mptr = & mint;
-^
The variable is reassigned tobe the location of mint
-^
Now:
*mptr
Address
Contents
mint
double values[ 7 ]
Equivalently, you could declare apointer
-^
int * valuesPtr;valuesPtr = values;
struct entry{
int
value;
struct entry *next;
}
-^
Example: Using a linked list:struct entry node1, node2;node1.next = &node2;