c语言 12-3
1、
#include <stdio.h> typedef struct{ int x; long y; double z; }Assign; Assign fun(int a, long b, double c) { Assign tmp; tmp.x = a; tmp.y = b; tmp.z = c; return tmp; } int main(void) { int i; long j; double k; printf("int i = "); scanf("%d", &i); printf("long j = "); scanf("%ld", &j); printf("double k = "); scanf("%lf", &k); Assign result = {8, 80, 8.8}; result = fun(i, j, k); puts("\n====================\n"); printf("result.x: %d\n", result.x); printf("result.y: %ld\n", result.y); printf("result.z: %.2f\n", result.z); return 0; }