设为首页 加入收藏

TOP

C语言基础二(四)
2010-12-26 22:19:29 】 浏览:17071
Tags:语言基础
d;
d=d-a+c-b;'Vtable
a,2,0
b,2,0
c,2,0
d,2,100
of Vtable
'Vupdate
1,0;2,0
3,0
4,100
1,80
2,180
3,360
4,200
of Vupdate
of Practice
[Practice] //2int a=5;
int b=9;
long int c;
long d;
c=a+b-7;
d=a*b*c;
c=d*d*d;
a=c-d;'Vtable
a,2,5
b,2,9
c,4,0
d,4,0
of Vtable
'Vupdate
1,5
2,9
3,0
4,0
3,7
4,315
3,31255875
1,-5112
of Vupdate
of Practice
[Practice] //3int a=6,b=19;
unsigned int c;
int d;
c=a-b+7;
d=b*c;
a=b+c+d;
b=-a;'Vtable
a,2,6
b,2,19
c,2,0
d,2,0
of Vtable
'Vupdate
1,6;2,19
3,0
4,0
3,65530
4,-114
1,-101
2,101
of Vupdate
of Practice
void main(){
long x,y;
int a,b,c,d;
x=5;
y=6;
a=7;
b=8;
c=x+a;
d=y+b;
printf("c=x+a=%d,d=y+b=%d\n",c,d);
}
将main说明为返回void,即不返回任何类型的值
x,y被定义为long型
a,b,c,d被定义为int型
5->x
6->y
7->a
8->b
x+a->c
y+b->d
显示程序运行结果 of long x,y;
int a,b,c,d;
c=x+a;
d=y+b;
  从程序中可以看到:x, y是长整型变量,a, b是基本整型变量。它们之间允许进行运算,运算结果为长整型。但c,d被定义为基本整型,因此最后结果为基本整型。本例说明,不同类型的量可以参与运算并相互赋值。其中的类型转换是由编译系统自动完成的。有关类型转换的规则将在以后介绍。

实型量

实型

首页 上一页 1 2 3 4 5 6 7 下一页 尾页 4/11/11
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇C语言基础三 下一篇C语言基础一

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目