| Arrays og Pointere - slide 26 : 30 |
Med statisk lagerallokering afsættes lagerplads implicit når den omkringliggende blok aktiveres. Lagerplads frigives implicit når blokken forlades.
#include <stdio.h>
#define N 500
#define K 10
void f(void) {
int i;
double tab1[N]; /* allocation of N doubles */
double tab2[N*K]; /* allocation of N*K doubles */
/* Use tab1 and tab2 */
/* Implicit deallocation of tab1 and tab2 memory at the end of f */
}
int main(void){
// ...
f();
// ...
}Udtryk som indgår i indeksgrænser for et array skal være statiske udtryk

![Forrige side: Statisk og dynamisk lagerallokering [Section] -- Tastaturgenvej: 'p' Forrige side: Statisk og dynamisk lagerallokering [Section] -- Tastaturgenvej: 'p'](./images/nav-left.gif)




