Skip to content

Instantly share code, notes, and snippets.

@tene
Created March 5, 2012 03:14
Show Gist options
  • Save tene/1976288 to your computer and use it in GitHub Desktop.
Save tene/1976288 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main (void)
{
int x = 42;
int *px = &x;
int ax[] = {56,57,58,59,60};
char *msg = "OHAI!";
char *pc;
printf(" x=%d\n", x);
printf(" &x=%p\n", &x);
printf(" px=%p\n", px);
printf("*px=%d\n", *px);
px = ax;
printf("\narrays:\n");
printf("*px =%d\n", *px);
printf("*(px+1)=%d\n", *(px+1));
printf("*(px+2)=%d\n", *(px+2));
printf("*(px+3)=%d\n", *(px+3));
printf("\nstrings:\n");
for (pc=msg; *pc != 0; pc++) {
printf("char: %c\n", *pc);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment