




















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





















Overview
int x = 5; int *countptr; countptr = &x;
Assigment in Pictures int x = 5; x
int *countptr; countptr
countptr = &x; countptr
x
countptr
Initialising a Pointer
float *yptr; xptr = NULL; yptr = NULL;
printf("...", *countptr);
int a = 3; *gptr; gptr = &a; *gptr = 7;
The & and * Operators Fig. 7. #include <stdio.h> int main() { int a = 7 ; int aptr; aptr = &a; / continued on next slide */
printf("Address of a is %lu\n", &a); printf("Value of aptr is %lu\n\n", aptr); printf("Value of a is %d\n", a); printf("Value of aptr is %d\n\n", aptr); printf("%s\n", "Proving that * and & are complements of each other."); printf("&aptr = %lu\n", &aptr); printf("*&aptr = %lu\n", *&aptr); return 0; }
Declarations and Initialisations int i = 3, j = 5, *p = &i, *q = &j, *r; double x; Expression Equivalent Expression Value p == &i p == (&i) 1 (true) p = i + 7 p = (i + 7) illegal **&p *p (^3) r = &x r = (&x) illegal