Last active
August 28, 2022 19:13
-
-
Save EteimZ/61de0a7d318ffe9dcd519e93d9f4498a to your computer and use it in GitHub Desktop.
Demonstration of C structs.
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 <stdio.h> | |
| int main(){ | |
| struct point{ | |
| int x; | |
| int y; | |
| }; | |
| struct point p1 = {10, 20}; | |
| struct point p2 = {40, 60}; | |
| printf("Point1(%d, %d)\n", p1.x, p1.y); | |
| printf("Point2(%d, %d)\n", p2.x, p2.y); | |
| return 0; | |
| } | |
| // output: | |
| // Point1(10, 20) | |
| // Point2(40, 60) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment