+ 1
What is the difference between a and a[i]
5 Respostas
+ 2
a is a normal variable whereas a[] is the variable which is used to define array. In a simple variable a we can assign only a single value but in a[] we can assign multiple values in array format.
+ 1
'a' here should be used to describe a variable name whereas 'a[i]' is used during the time when you want to use a sign a value to array
0
If a1 have been declared as a pointer,
for example: int *a1 = new int[5];
the a1 itself saves the address of the first block of the memory that is reserved by new operator.
Now for accessing the content of that blocks, we can use a1[i], and the i can be 0, 1, 2, 3 and 4, because only 5 blocks is reserved in memory by new operator.
Because a1 is a int pointer, the size of any block becomes 4 bytes and the reserved memory becomes 5 * 4 = 20 bytes.
0
A means thats a single number like int or char or fload. But A[ ] shows an array of them ☺️
0
a is integer whereas a[ ] is an array which contain integers