#include<stdio.h>
int add(int g,int h){
return g+h;
}
void printPic(){
printf("********\n*itheima*\n********\n");
}
void hello(){
printf("hello world!\n");
}
void ad(){
int num=12;
printf("第二个num是:%d\n",num);
}
int main(){
char a='c';
char c;
int b;
int e=1000;
int g=100;
int count;
int h=100;
int j=3>3;
double f=1028.8141028;
int num=21;
{
int num=25;
printf("第一个num是:%d\n",num);
}
ad();//作用域
count=add(g,h);//两个整型数相加
j=3>3?1+2:3-4;//三目运算
printPic();//打印图形
hello();//打印hello world!
b=e;
e=g;
g=b;//互换
printf("第三个num是:%d\n",num);
printf("三目运算的值:%d\n",j);
printf("b=%d\ne=%d\ng=%d\n",b,e,g);
printf("g和h的和:%d\n",count);
printf("%010d\n%.3lf\n",e,f);//控制位数
printf("%lu\n",sizeof b);//打印整型占位个数
printf("%lu\n",sizeof c);//打印字符占位数
printf("%d\n",a);//打印字符对对应的ASCII码
printf("%lu\n",sizeof (double));
printf("这是g的地址:%p\n",&g);//打印分配的地址
return 0;
|
|