C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
PointerPointer is used to points the address of the value stored anywhere in the computer memory. To obtain the value stored at the location is known as dereferencing the pointer. Pointer improves the performance for repetitive process such as:
Pointer Details
ProgramPointer#include <stdio.h> int main( ) { int a = 5; int *b; b = &a; printf ("value of a = %d\n", a); printf ("value of a = %d\n", *(&a)); printf ("value of a = %d\n", *b); printf ("address of a = %u\n", &a); printf ("address of a = %d\n", b); printf ("address of b = %u\n", &b); printf ("value of b = address of a = %u", b); return 0; } Outputvalue of a = 5 value of a = 5 address of a = 3010494292 address of a = -1284473004 address of b = 3010494296 value of b = address of a = 3010494292 ProgramPointer to Pointer#include <stdio.h> int main( ) { int a = 5; int *b; int **c; b = &a; c = &b; printf ("value of a = %d\n", a); printf ("value of a = %d\n", *(&a)); printf ("value of a = %d\n", *b); printf ("value of a = %d\n", **c); printf ("value of b = address of a = %u\n", b); printf ("value of c = address of b = %u\n", c); printf ("address of a = %u\n", &a); printf ("address of a = %u\n", b); printf ("address of a = %u\n", *c); printf ("address of b = %u\n", &b); printf ("address of b = %u\n", c); printf ("address of c = %u\n", &c); return 0; } Pointer to Pointervalue of a = 5 value of a = 5 value of a = 5 value of a = 5 value of b = address of a = 2831685116 value of c = address of b = 2831685120 address of a = 2831685116 address of a = 2831685116 address of a = 2831685116 address of b = 2831685120 address of b = 2831685120 address of c = 2831685128
Next TopicDS Structure
|