+ -
当前位置:首页 → 问答吧 → C语言的表达式语句与表达式?

C语言的表达式语句与表达式?

时间:2011-12-21

来源:互联网

一,表达式语句:
x=x+1;
分为以下4个表达式:
(1)x
(2)1
(3)x+1
(4)x=x+1
对否?
二,表达式语句:
++x;
分为以下2个表达式:
(1)x
(2)++x
对否?

作者: mpaga   发布时间: 2011-12-21

理解不是很清晰

若是y = ++x; 先计算++x; 之后y = x;

y = x+1;
汇编之后了认为下面三步骤:
x
x+1;
y = x+1;

作者: pclvmm   发布时间: 2011-12-21

《C语言程序设计 现代方法》第4章 表达式
最简单的表达式是变量和常量。

书上的意思是说,变量或者常量,它们都是表达式!那么:
(1)x  
(2)1 //常量1,也是表达式了。
(3)x+1
(4)x=x+1

作者: mpaga   发布时间: 2011-12-21

C Primary Expressions 
The operands in expressions are called “primary expressions.” 

Syntax

primary-expression :

identifier
constant
string-literal
( expression )

expression :

assignment-expression
expression , assignment-expression

作者: zhao4zhong1   发布时间: 2011-12-21

Types of Expressions
C++ expressions are divided into several categories: 

Primary expressions. These are the building blocks from which all other expressions are formed.  


Postfix expressions. These are primary expressions followed by an operator — for example, the array subscript or postfix increment operator.  


Expressions formed with unary operators. Unary operators act on only one operand in an expression.  


Expressions formed with binary operators. Binary operators act on two operands in an expression.  


Expressions with the conditional operator. The conditional operator is a ternary operator — the only such operator in the C++ language — and takes three operands.  


Constant expressions. Constant expressions are formed entirely of constant data.  


Expressions with explicit type conversions. Explicit type conversions, or “casts,” can be used in expressions.  


Expressions with pointer-to-member operators.  


Casting. Type-safe “casts” can be used in expressions.  


Run-Time Type Information. Determine the type of an object during program execution.  

作者: zhao4zhong1   发布时间: 2011-12-21

3楼:
  有中文么?

作者: mpaga   发布时间: 2011-12-21