C语言基础:变量、类型与控制结构详解
1. 变量与类型
在C语言编程中,变量和类型是基础且关键的部分。下面我们通过一个示例代码来深入了解不同类型变量的声明和使用。
#include <stdio.h>
int main(int argc, char* argv[])
{
int distance = 100;
float power = 2.345f;
double super_power = 56789.4532;
char initial = 'A';
char first_name[] = "Zed";
char last_name[] = "Shaw";
printf("You are %d miles away.\n", distance);
printf("You have %f levels of power.\n", power);
printf("You have %f awesome super powers.\n", super_power);
printf("I have an initial %c.\n", initial);
printf("I have a first name %s.\n", first_name);
printf("I have a last name %s.\n", last_name);
printf("My whole name is %s %c. %s.\n", first_name, initial, last_name);
int bugs = 100;
do
超级会员免费看
订阅专栏 解锁全文

888

被折叠的 条评论
为什么被折叠?



