Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

pointer operators in c

&  ==> address operator
*  ==> dereference operator

// Example
int a = 1;
int *ptr; // int * defines a pointer variable pointing at an int
ptr = &a; // the address of 'a' is assigned to the pointer

// 'ptr' is now equal to the address of 'a'
// when dereferenced using *, it returns the value at that address

printf("value of a: %d", *ptr); // prints "value of a: 1"
 
PREVIOUS NEXT
Tagged: #pointer #operators
ADD COMMENT
Topic
Name
8+1 =