Skip to content

Instantly share code, notes, and snippets.

@naohaq
Created November 15, 2012 05:38
Show Gist options
  • Save naohaq/4076835 to your computer and use it in GitHub Desktop.
Save naohaq/4076835 to your computer and use it in GitHub Desktop.
Using a pointer to a struct without any definition.
#include <stdio.h>
#include <stdlib.h>
struct hoge * tmp_ptr;
void
foo( void )
{
printf("%p\n", tmp_ptr);
}
int
main( )
{
void * p = malloc(16*4);
tmp_ptr = p;
foo( );
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment