What can be concluded form the following declaration? A)x is an array of 10 pointer. B)x is a pointer to an array of 10 integer? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

What can be concluded form the following declaration? A)x is an array of 10 pointer. B)x is a pointer to an array of 10 integer?

int (*x)[10];

28th Oct 2016, 8:31 PM
AKSHAY MALVIYA
AKSHAY MALVIYA - avatar
2 ответов
+ 1
x is a pointer to array of integers. Actually, when you write just int x[], x is pointer to first element in that array. When you do 'cout << x', it should print address of first element in array x. If you want to get second element, you can use x[1], but you can also use *(x+1). I just want to say that 'int x[]' and 'int (*x)[]' are the same.
28th Oct 2016, 9:22 PM
Daniel Oravec
Daniel Oravec - avatar
0
thnkew buddy
28th Oct 2016, 9:25 PM
AKSHAY MALVIYA
AKSHAY MALVIYA - avatar