/*C語言 結構變數設定初值*/
#include<stdio.h>
#include<stdlib.h>

int main(void)
{
    struct data
    //定義結構
    {
        char name[10];
        int score;
    }student = {"Jackson", 81};

    printf("姓名:%s\n", student.name);
    printf("分數:%d\n", student.score);

    system("pause");
    return 0;
}

結果為:

image

arrow
arrow
    創作者介紹
    創作者 愛學習 的頭像
    愛學習

    愛學習

    愛學習 發表在 痞客邦 留言(0) 人氣()