1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #include <stdio.h> struct Point { int x; int y; int z; }; struct Point MakePoint(x, y, z) { struct Point p; p.x = x; p.y = y; p.z = z; if (x <= 0) { return p; } MakePoint(x - 1, y, z + 1); } int main(void) { struct Point p0; struct Point p1; p0.x = 0; p0.y = 1; p0.z = 2; printf("(%d,%d,%d)\n", p0.x, p0.y, p0.z); p1 = MakePoint(10, -2, -10); printf("(%d,%d,%d)\n", p1.x, p1.y, p1.z); return 0; } |