结构体里的结构体。赋值

#include <stdio.h>


typedef struct shutter //第一个结构体定义
{
int min;
int max;
}shutter_t;

typedef struct image_s //第二个结构体定义
{
int hue;
int sharpness;
shutter_t judge; //把第一个结构体里的元素放到第二个结构体里
}image_t;
int main()
{
image_t image;
image.hue=5;
image.sharpness=6;
image.judge.max=8;
printf("hue:%d\n",image.hue);
printf("sharppness:%d\n",image.sharpness);
printf("judge:%d\n",image.judge.max);
}
原文地址:https://www.cnblogs.com/qingjoin/p/2284739.html