0

3 questions in one challenge code??

char *arr[] = {"C", "C++", "Java", "VBA"}; char *(*ptr)[4] = &arr; cout << ++(*ptr)[2]<<endl https://code.sololearn.com/cQ28Uhvpyhgv/?ref=app

30th Mar 2019, 10:00 AM
Alireza Abbasi
Alireza Abbasi - avatar
1 Antwort
+ 2
First line varName[] without digit in bracket is any size of array assignment {c, c++,...} so the array is of size 4 The elements of the array are string. Which is an array of char. char *varName = "abcde" We can assign string to pointer of char (pointer is default to be pointing to the first element of the iteratable) Second line varName[4] the digit 4 inside square bracket means of size 4 char *pointerName = &address is for renaming the pointer Because the elements in array is also array, so *(*ptr) Third line [2] is the third element, which is Java *ptr is pointing to J ++ shifts the pointer to the right by 1 So that result is ava
30th Mar 2019, 11:02 AM
Gordon
Gordon - avatar