Last active
March 18, 2016 20:01
-
-
Save daniel-packard/fd67a58c6342119f85f3 to your computer and use it in GitHub Desktop.
Demos some basic properties of struct assignments.
This file contains 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> | |
typedef struct { | |
int x; | |
int y; | |
} point_t; | |
void printPoint(point_t p) { | |
printf("X: %d, Y: %d\n", p.x, p.y); | |
} | |
int main (int argc, char* argv[]) { | |
point_t x1 = {.x=10, .y=20}; | |
point_t x2 = {.x=30, .y=40}; | |
x2 = x1; | |
printPoint(x1); | |
printPoint(x2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment