Re: [cc65] Using pointers to arrays

From: Marc 'BlackJack Rintsch <>
Date: 2009-09-27 10:57:47
On Saturday 26 September 2009, wrote:
> I know how to declare a pointer to an array <char* (*list) [32]> but 
> how do I allocate and use one?

While it is possible to declare it in one step, I would prefer splitting 
it up with a type definition.  Then it is easier to read and you don't 
have to retype parts of the declaration when getting the size to 


#include <stdio.h>
#include <stdlib.h>

typedef char* A[32];
A *list;

int main(void)
    list = calloc(1, sizeof(A));
    *list[3] = "hello";
    return 0;


Of course a more meaningful name than `A` should be used.

	Marc 'BlackJack' Rintsch
"Very funny, Scotty. Now beam down my clothes."

To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Sep 27 10:57:53 2009

This archive was generated by hypermail 2.1.8 : 2009-09-27 10:57:54 CEST