diff options
author | Adam Brenecki <adam@brenecki.id.au> | 2013-08-15 20:03:04 +0930 |
---|---|---|
committer | Adam Brenecki <adam@brenecki.id.au> | 2013-08-15 20:03:04 +0930 |
commit | 6ff1d84385206ff1e3901e863c296f8ce329cc31 (patch) | |
tree | 7706d37a72edb7b53c5b2b19356b1de1d6c0c692 /c.html.markdown | |
parent | 5f2928df6b19337426bed0a60650be79bda437a1 (diff) | |
parent | bc614fda28179f0b7eb98a9283cfc6721765b6cf (diff) |
Merge branch 'master' of https://github.com/adambard/learnxinyminutes-docs
Diffstat (limited to 'c.html.markdown')
-rw-r--r-- | c.html.markdown | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/c.html.markdown b/c.html.markdown index d243b19d..2b50efa0 100644 --- a/c.html.markdown +++ b/c.html.markdown @@ -230,10 +230,13 @@ printf("%p\n", &x); // Use & to retrieve the address of a variable // (%p formats a pointer) // => Prints some address in memory; -// Pointer types end with * in their declaration -int* px; // px is a pointer to an int + +// Pointers start with * in their declaration +int *px, not_a_pointer; // px is a pointer to an int px = &x; // Stores the address of x in px printf("%p\n", px); // => Prints some address in memory +printf("%d, %d\n", (int)sizeof(px), (int)sizeof(not_a_pointer)); +// => Prints "8, 4" on 64-bit system // To retreive the value at the address a pointer is pointing to, // put * in front to de-reference it. |