gpt/2025-12-09: structs
crispy-caesus crispy@crispy-caesus.eu
Tue, 09 Dec 2025 15:16:29 +0100
1 files changed,
23 insertions(+),
0 deletions(-)
jump to
A
gpt/2025-12-09/structtest.c
@@ -0,0 +1,23 @@
+#include <stdio.h> +#include <stdlib.h> + +typedef struct point3D { + char name; + float x; + float y; + float z; +} p3d; + +int main(){ + p3d *p; + p = (p3d*) malloc(sizeof(p3d)); + + printf("name, x, y, z:\n"); + scanf("%c", &p->name); + scanf("%f", &p->x); + scanf("%f", &p->y); + scanf("%f", &p->z); + printf("Koordinaten von %c: (%f, %f, %f)", p->name,p->x,p->y,p->z); + + return 0; +}