Introduction
Pointers let you store the address of a variable so you can work with the variable's location directly.
type *pointerName;
int *p;char *cptr;float *fptr;#include <stdio.h> int main() { int num = 10; int *ptr = # // ptr stores the address of num printf("Value of num: %d\n", num); printf("Address of num: %p\n", (void*)&num); printf("Value stored in ptr (address of num): %p\n", (void*)ptr); printf("Value pointed to by ptr: %d\n", *ptr); return 0; }
int *ptr;int x = 10;
int *p = &x;
printf("%d", *p);int *p; p = 5;
num through the pointer?int num = 20; // Which declaration is correct?
Pass the test and this pattern moves unknown