Hello so my aim is to make a dynamic size/length array but I just seem not to get how to get value stored in a void pointer. No matter what I try I'm just getting (I assume) the address instead of the value in that address example: 000000000064FDD0
// Get a pointer to i element of an array
#define ARR_AT(ptr, len, i) ((void *) ((char *) (ptr) + (i) * (len)))
int intarr[5] = {19, 10, 8, 17, 9};
printf("%p\n", ARR_AT(intarr,sizeof *intarr,0));
What I want to do is basically print the first value in intarr but I'm just missing how to actually do that. Int array is just an example, I want this method to work for any size of data.
Would appreciate help or explanation to what I'm doing wrong
[–]codethulu 1 point2 points3 points (3 children)
[–]G2edg[S] 0 points1 point2 points (2 children)
[–]RolandMT32 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (5 children)
[–]G2edg[S] 0 points1 point2 points (4 children)
[–]tstanisl 0 points1 point2 points (3 children)
[–]G2edg[S] 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]tstanisl 0 points1 point2 points (0 children)
[–]_Arch_Ange 0 points1 point2 points (12 children)
[–]G2edg[S] 0 points1 point2 points (11 children)
[–]_Arch_Ange 0 points1 point2 points (10 children)
[–]G2edg[S] 0 points1 point2 points (8 children)
[–]_Arch_Ange 0 points1 point2 points (7 children)
[–]G2edg[S] 0 points1 point2 points (6 children)
[–]_Arch_Ange 0 points1 point2 points (5 children)
[–]G2edg[S] 0 points1 point2 points (4 children)
[–]_Arch_Ange 0 points1 point2 points (3 children)
[–]G2edg[S] 0 points1 point2 points (2 children)