Trying to create a pointer to an array.

TRGBTriple pixa[480000]; pixa* pix; //Error: Multiple declaration for "pixa" 

I want to create a typed pixa pix type pointer.

    2 answers 2

    pixa in the first line is not a type, but an array name. If you want to make it a data type, write

     typedef TRGBTriple pixa [480000]; pixa pix; // массив переменных типа TRGBTriple размером 480000 pixa* pix; // указатель (!!!) на такой массив 

      Actually, an array is a pointer. What is written here is trying to declare the pix variable to be a pointer to the pixa type, but there is no such type.

      If you need to create a pointer to a pointer, you can write like this:

      TRGBTriple** = &pixa

      But I doubt that this is necessary, so just work with pixa as a pointer to TRGBTriple , though in this case, since the array is stored on the stack, you cannot change its value (the value of the pointer, and not what it costs). Correct me if not so.