Skip to content

Instantly share code, notes, and snippets.

@EteimZ
Last active August 28, 2022 19:13
Show Gist options
  • Select an option

  • Save EteimZ/61de0a7d318ffe9dcd519e93d9f4498a to your computer and use it in GitHub Desktop.

Select an option

Save EteimZ/61de0a7d318ffe9dcd519e93d9f4498a to your computer and use it in GitHub Desktop.
Demonstration of C structs.
#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