#include<stdio.h> struct xyz{ int x; long y; double z; }; struct xyz xyz_of(int x, long y, double z) { struct xyz temp; temp.x = x; temp.y = y; temp.z = z; return temp; } int main(void) { struct xyz s = {0,0,0}; s = xyz_of(12,7654321,35.689); printf("xyz.x = %d\n", s.x); printf("xyz.y = %ld\n", s.y); printf("xyz.z = %f\n", s.z); return 0; }
返回结构体的函数示例
猜你喜欢
转载自blog.csdn.net/weixin_39690617/article/details/79574808
今日推荐
周排行