字符串和格式化输入输出 #include<stdio.h> #include<string.h> #define DENSITY 62.4 int main(void) { float weight, volume; int size, letters; ];//数组 printf("Hi!What's your first name?"); gets(name);//get(sth.)取得地址 printf("%s,What's your weigh…
1.C语言字符串 字符串(character string)是一个或多个字符的序列,例如:"Zing went the strings of my heart!" C语言没有专门用于储存字符串的变量类型,字符串都被储存在char类型的数组中.数组由连续的存储单元组成,字符串中的字符被储存在相邻的存储单元中,每个单元储存一个字符.如下图: 注意图4.1中数组末尾位置的字符\0.这是空字符(null character),C语言用它标记字符串的结束.空字符不是数字0,它是非打印字符,其AS…