題目:簡單的結構體應用實例。
程序分析:無。
程序源代碼:
// Created by www.runoob.com on 15/11/9. // Copyright © 2015年 菜鳥教程. All rights reserved. // #include <stdio.h> struct programming { float constant; char *pointer; }; int main() { struct programming variable; char string[] = "菜鳥教程:http://www.runoob.com"; variable.constant = 1.23; variable.pointer = string; printf("%f\n", variable.constant); printf("%s\n", variable.pointer); return 0; }
以上實例運行輸出結果為:
1.230000 菜鳥教程:http://www.runoob.com