Created
January 25, 2020 17:25
-
-
Save rexim/d2fd57d6f886f545cf5fa2ec9082612c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <assert.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| typedef struct { | |
| int x; | |
| int y; | |
| } Point; | |
| int main(int argc, char *argv[]) | |
| { | |
| if (argc < 2) { | |
| assert(argc >= 1); | |
| fprintf(stderr, "Usage: %s <N>\n", argv[0]); | |
| exit(1); | |
| } | |
| int n = atoi(argv[1]); | |
| Point *points = malloc(sizeof(Point) * n); | |
| for (int i = 0; i < n; ++i) { | |
| points[i].x = i; | |
| points[i].y = i; | |
| } | |
| free(points); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment