How to create your own data type in C

1 Answer

0 votes
#include <stdio.h>

typedef struct Point {
    double x;
    double y;
} Point;

int main() {
    Point p = {
        .x = 3.1,
        .y = 7.5
    };
    
    printf("%lf %lf\n", p.x, p.y);
    
    return 0;
}
     
     
          
/*
run:
       
3.100000 7.500000
    
*/

 



answered Dec 25, 2020 by avibootz

Related questions

4 answers 352 views
2 answers 233 views
1 answer 231 views
1 answer 128 views
1 answer 143 views
143 views asked Mar 8, 2022 by avibootz
...