C 练习实例95
题目:简单的结构体应用实例。
程序分析:无。
程序源代码:
实例
// Created by www.www.fxku.cn 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[] = "小库网:https://www.www.fxku.cn";
variable.constant = 1.23;
variable.pointer = string;
printf("%f\n", variable.constant);
printf("%s\n", variable.pointer);
return 0;
}
// Copyright ? 2015年 小库网. All rights reserved.
//
#include <stdio.h>
struct programming
{
float constant;
char *pointer;
};
int main()
{
struct programming variable;
char string[] = "小库网:https://www.www.fxku.cn";
variable.constant = 1.23;
variable.pointer = string;
printf("%f\n", variable.constant);
printf("%s\n", variable.pointer);
return 0;
}
以上实例运行输出结果为:
1.230000 小库网:https://www.www.fxku.cn