logo

Creating your own data type in C

#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct Point { double x; double y; } Point; int main(int argc, char* argv[]) { Point p = { .x = 0.25, .y = 0.78 }; printf("%lf %lf\n", p.x, p.y); return 0; }

Courses with this lesson