Re: Static data?
Re: Static data?
- Subject: Re: Static data?
- From: Markus Hitter <email@hidden>
- Date: Tue, 6 Jul 2004 22:24:29 +0200
Am 03.07.2004 um 17:03 schrieb Allan Odgaard:
On 3. Jul 2004, at 11:26, Markus Hitter wrote:
There are cases where this transformation cannot happen, like:
long data[1024][1024];
->
data = ...?
From the C-FAQ (<http://www.faqs.org/faqs/C-faq/faq/>) 6.16:
int **array1 = malloc(nrows * sizeof(int *));
for(i = 0; i < nrows; i++)
array1[i] = malloc(ncolumns * sizeof(int));
...
... the elements of the dynamic array can be accessed with
normal-looking array subscripts: arrayx[i][j]
The advantage of static or automatic storage (as opposed to heap
allocated storage) is that you do *not* need to handle errors, cause
there will be none, ...
The errors appear at app launch time. Even more likely as malloc(), as
there are tighter limitations.
Cheers,
Markus
- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter
http://www.jump-ing.de/
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.