Skip to content

Instantly share code, notes, and snippets.

@gshrikant
Created March 22, 2017 09:07
Show Gist options
  • Save gshrikant/c3a28df5a7f9b3bac71e11cdbb8ffff3 to your computer and use it in GitHub Desktop.
Save gshrikant/c3a28df5a7f9b3bac71e11cdbb8ffff3 to your computer and use it in GitHub Desktop.
Structure Pointers
/*
* structs-3.c
* Use struct pointers without declaring the struct itself!
*/
#include <stdio.h>
int
main(void)
{
struct made_up_struct* something;
something = (struct made_up_struct*) &something;
printf("This compiles!\n");
printf("Proof: address of pointer to struct on stack: %p\n",
(void*) something);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment