Skip to content

Instantly share code, notes, and snippets.

@diegofigueroa
Created January 19, 2014 18:00
Show Gist options
  • Save diegofigueroa/8508527 to your computer and use it in GitHub Desktop.
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.
#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