pointer in c programming code example
Example 1: poiner in c
int* pc, c, d;
c = 5;
d = -15;
pc = &c; printf("%d", *pc); // Output: 5
pc = &d; printf("%d", *pc); // Ouptut: -15
Example 2: how to make pointers in c
datatype *var;
variable var actually holds the address of the data(memory where it is stored)
*var lets you access the data stored at that address
Example 3: poiner in c
int c, *pc;
// pc is address but c is not
pc = c; // Error
// &c is address but *pc is not
*pc = &c; // Error
// both &c and pc are addresses
pc = &c;
// both c and *pc values
*pc = c;
Example 4: How to use pointers in C
myvar = 25;
foo = &myvar;
bar = myvar;