Search found 3 matches

by FunkyELF
Fri Sep 05, 2003 5:06 am
Forum: C
Topic: malloc
Replies: 17
Views: 10537

sorry for the n00bish question, but if I use the following code

[c]int **array = (int**)calloc(ROWS, sizeof(int*));
for(i=0; i<ROWS;i++)
array = (int*)calloc(COLS,sizeof(int));[/c]

and I wanted to iterate through this array[][]....which set of []'s would be associated with ROWS, and which with ...
by FunkyELF
Thu Jul 24, 2003 9:42 am
Forum: C
Topic: malloc
Replies: 17
Views: 10537

ok, no compile errors this time, but I get runtime errors from the following program when trying to printf from the array. Also, I could not scanf into the array.

[c]#include <stdlib.h>
#include <stdio.h>

int main(void)
{
int **a = (int **)calloc(10*10,sizeof(int));
a[0][2] = 3;
printf("%d \n ...
by FunkyELF
Wed Jul 23, 2003 7:10 pm
Forum: C
Topic: malloc
Replies: 17
Views: 10537

Uhm, I'm trying to do the same thing and malloc a 2-d array. I've tried everything here and could not get it to work. If you're sure your method works, could you post the entire compileable code?

Go to advanced search