1#include <stdio.h>
2#include <stdlib.h>
3
4int main() {
5 int *nums;
6 int x;
7// Allocate storage for 3 integers
8 nums = (int *)malloc( sizeof(int) * 3 );
9 if( nums==NULL ) {
10 fprintf(stderr,"Memory allocation error\n");
11 exit(1);
12 }
13// Assign the integer values
14 for( x=0; x<3; x++ )
15 *(nums+x) = x+1;
16// Output the results
17 printf("%d %d %d\n",
18 *(nums+0),
19 *(nums+1),
20 *(nums+2)
21 );
22 return(0);
23}