home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_09_06
/
9n06018b
< prev
next >
Wrap
Text File
|
1991-02-17
|
511b
|
34 lines
#include <stdio.h>
#include <stdlib.h>
main()
{
int rows = 0;
long **pl;
int i;
while (rows < 1) {
printf("Enter number of 10 element rows: ");
scanf("%4d", &rows);
}
pl = malloc(rows * sizeof(long *));
if (pl == NULL) {
printf("malloc of pl failed\n");
exit(1);
}
for (i = 0; i < rows; ++i) {
pl[i] = malloc(10 * sizeof(long));
if (pl[i] == NULL) {
printf("malloc of pl[%d] failed\n", i);
exit(1);
}
}
pl[0][2] = 1234;
pl[0][9] = 9876;
}