Declarating arrays.
Arrays occupy space memory.The programmer specifies the type of each element and the number of the elements required by and array as follows;
Type arrayaname [araySize];
And the compiler reserves the appropriate amount of memory.for example,to tell the compiler to reserve 12 element for interger arrau c,use the declaration
Int c[12]
Operator |
Associativity |
Type |
( ) [ ] |
left to right |
highest |
++ -- ssatic_cast<type> (opearnd) |
left to right |
unary |
++ -- + -! |
right to left |
unary |
* / % |
left to right |
multiplecative |
+ - |
left to right |
addittive |
<< >> |
left to right |
insertion/extraction |
< <= > >= |
left to right |
relational |
== != |
left to right |
equality |
&& |
left to right |
logical AND |
|| |
left to right |
logical OR |
?: |
left to right |
conditional |
= += -= /= %= |
left to right |
assigment |
Memory can be reversed for several array with a single decalaration.The following decalaration reserves 100 elements for the interger array b and 27 element for interger x
Int b [100],x[27];Array can be declaration to contain any tipe data.for example,an array of type cahar can be used to strore a character string
0 Response for the "Declarating arrays."
Post a Comment