Created
January 19, 2014 18:00
-
-
Save diegofigueroa/8508527 to your computer and use it in GitHub Desktop.
Very simple sample of a pointer pointing to an array's base address.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void main(){ | |
int array[3] = {5, 10, 15}; | |
int* p; | |
p = array; | |
printf("p = %p, *p = %d\n", p, *p); | |
p = &array; | |
printf("p = %p, *p = %d\n", p, *p); | |
p = &array[0]; | |
printf("p = %p, *p = %d\n", p, *p); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment