1.前导程序
![](https://i-blog.csdnimg.cn/blog_migrate/81178cc93a2a3bb5048d90d76e7ec935.gif)
1 #include<stdio.h>
2 #include<string.h> //1提供strlen()的函数原型
3 #define DENSITY 62.4 //2预处理命令
4 int main(void)
5 {
6 float weight,volume;
7 int size,letters;
8 char name[40]; //3定义一个长度为40的数组
9
10 printf("Hi! What's your first name?\n");
11 scanf("%s",name);
12 printf("%s,What's your weight in pounds?\n",name);
13 scanf("%f",&weight);
14 size=sizeof name; //4 数组name[]的长度
15 letters=strlen(name);//5 调用函数strlen()
16 volume=weight/DENSITY;
17