Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Pointer to an array of pointers.

Name: Anonymous 2007-09-13 21:24 ID:Ly++VlgN



    int lol = 3;
    int *lol_ptr = &lol;

    int *ptr_array;
    ptr_array = malloc(sizeof(lol_ptr));

    ptr_array[0] = lol_ptr;

    printf("%d\n", (*(*ptr_array[0])));


gcc gives the following error:

error: invalid type argument of 'unary *'

Halp.

Name: Anonymous 2007-09-13 21:56 ID:j06eg3jj

#include <stdio.h>
#define ARRAY_SIZE 1

int main()
{
int value = 3;
int *intPointer = NULL;
int **intPointerArray = NULL;
intPointer = &value;
intPointerArray = malloc(sizeof(int*) * ARRAY_SIZE);
intPointerArray[0] = intPointer;
printf("%i",*intPointerArray[0]);
getchar();
return 0;
}


THAT TASK WAS FUCKING TRIVIAL YOU STUPID RETARD

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List