delorie.com/archives/browse.cgi | search |
From: | Jason Alexander <jalex AT ea DOT oac DOT uci DOT edu> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Dynamically declaring 2-d arrays |
Date: | Mon, 09 Feb 1998 15:54:44 -0800 |
Organization: | University of California, Irvine |
Lines: | 18 |
Message-ID: | <34DF9744.C7CFDBFE@ea.oac.uci.edu> |
NNTP-Posting-Host: | pv1821.pv.reshsg.uci.edu |
Mime-Version: | 1.0 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Can someone explain to me how to dynamically declare a 2-d array? I know the following code works for dynamically declaring a 1-d array of integers, but I don't see how to extend it to the 2-d case. int main(void) { int i; int *array; printf("Array dimension: "); scanf("%d", &i); array = (int *) malloc(i*sizeof(int)) } Thanks, Jason
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |