What is a subexpression in C?

What is a subexpression in C? I thought that combining a smaller expression is a subexpression for example:a*(b+C/d)/20

b+c/dis a subexpression, is it right? or is one c/da subexpression?

+4
source share
4 answers

A subexpression is not just part of a larger expression.

Consider:

2 * 3 + 4 * 5

This is 3+4*5not a sub-expression.

Full expression parses as

(2 * 3) + (4 * 5)

therefore direct subexpressions 2*3and 4*5.

Each of them is again understood as compositions of smaller things, moreover, it 2*3consists of subexpressions 2and 3, and c 4*5consists of subexpressions 4and 5.

, : 2*3, 4*5, 2, 3, 4 5.

, , 3+4*5 .

, , .


a*(b+C/d)/20

b+c/d , ? c/d ?

( / ).

, , b+C .

+5

c.i,

. .
- , .

, 20. /20 , -. :

, , .. node . , .

:

b + c/d - , ?

.

c/d ?

. a, b, C, d, 20, b+C/d a*(b+C/d) - .

+4

sub , C/d b+C/d ,

.

C/d , (b+C/d)
, (b+C/d), C/d (b+C/d) .

, a*(b+C/d) .

/20 , -.

, , , , , , ( ).

+4
source

An expression is a sequence of operators and operands that the calculation defines. An expression can lead to meaning and can cause side effects. [§5.1]

So, b+c/dand c/dboth are expressions. Even, a, b, c, dand 20are expressions.

+1
source

Source: https://habr.com/ru/post/1532968/


All Articles