+ 1

What is the difference between a and a[i]

21st Oct 2016, 2:25 AM
vignesh
5 odpowiedzi
+ 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.
2nd Feb 2017, 5:55 AM
Ashu Bagul
Ashu Bagul - avatar
+ 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
17th Feb 2017, 2:39 PM
hyder ali
hyder ali - avatar
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.
21st Oct 2016, 3:27 AM
Morteza
0
A means thats a single number like int or char or fload. But A[ ] shows an array of them ☺️
26th Oct 2016, 7:04 PM
Moein Ghandehari
Moein Ghandehari - avatar
0
a is integer whereas a[ ] is an array which contain integers
6th Nov 2016, 10:19 AM
Suman Saurav
Suman Saurav - avatar