Help with the C+++ indicator mission
-
int main() { char *c[] = {"ENTER", "NEW", "POINT", "FIRST"}; char **cp[] = {c+3, c+2, c+1, c}; char ***cpp = cp; printf("%s", **++cpp); printf("%s", *--*++cpp+3); printf(" %s", *cpp[-2]+3); printf("%s", cpp[-1][-1]+1); system("pause"); return 0; }
Please explain why the conclusion: POINTER STEW
The lesson didn't explain anything about the signs, the increments and the dicrement.
I also don't understand why the code
printf("%s", *(c+1));
They'll be together.
printf("%s", *++c);
It's not gonna work.
-
//массив указателей на строковые константы char *c[] = {"ENTER", "NEW", "POINT", "FIRST"}; char **cp[] = {c+3, c+2, c+1, c}; //первый элемент c+3, // т.е. мы идем три раза вперед на размерность с и попадаем на POINT char ***cpp = cp; //ехал указатель через указатель, // видит в реке указатель, // сунул указатель в указатель, // гитлер гитлер гитлер гитлер printf("%s", **++cpp); //выводится POINT printf("%s", *--*++cpp+3); //снова шастаем по указателям, // приходим на ENTER, прыгаем на 3 размера данного указателя вперед // (теперь это char жизнь, сынок, это просто, как ездить на велосипеде, // и мы в аду и ты горишь и велосипед горит) // вместо ENTER получаем ER (ENT ER) // выводится в итоге POINTER
You know what I mean.
And, yes, you have the horrors.
When someone sees this terrible example and takes a more detailed look, I'd be happy to remove the answer, and I'm begging for the razor's ears not to pass.
http://cboard.cprogramming.com/c-programming/102584-array-pointers-confusion.html A hint of decision, thanks for a good example, pointer stew goes around the corner, the task of the book " http://rads.stackoverflow.com/amzn/click/0201604612 ♪
p.s. Pointer stew is translated as (high) soup (huffle, carcase) indicators. The sign soup. Beautiful.