#include <stdio.h> /* declare the Point type */ typedef struct { int x, y; } Point; /* function to print a Point */ void printPoint( Point *p ) { printf("(%d, %d)\n", p->x, p->y ); } int main(int argc, char *argv[]) { /* declare a Point and allocate memory */ Point *point = (Point *)malloc( sizeof( Point ) ); /* don't change these statements */ point->x = -23; point->y = 45; /* print values */ printPoint( point ); /* free memory */ free( point ); system("pause"); return 0; }
Comments: