S
sarathy
Hi,
I read the following points in K&R "Section A8.7 Initialization".
Seems like i have a problem with them.
* All expressions in the initialization of constant object/array must
be constant expression. [OK,fine]
* Expressions in the initializer for an auto or register object or
array must likewise be constant expressions if the initializer is a
brace enclosed list. [ ????]
But
auto int a=10;
auto int b[]={a,a++};
works fine.
* If the initializer for an automatic object[auto or register] is a
single expression, it need not be a constant expression.
What does single expression mean here ?
Regards,
Sarathy
I read the following points in K&R "Section A8.7 Initialization".
Seems like i have a problem with them.
* All expressions in the initialization of constant object/array must
be constant expression. [OK,fine]
* Expressions in the initializer for an auto or register object or
array must likewise be constant expressions if the initializer is a
brace enclosed list. [ ????]
But
auto int a=10;
auto int b[]={a,a++};
works fine.
* If the initializer for an automatic object[auto or register] is a
single expression, it need not be a constant expression.
What does single expression mean here ?
Regards,
Sarathy