[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Display of 2D dinamic arrays
From: |
Leonardo Giordani |
Subject: |
Display of 2D dinamic arrays |
Date: |
Thu, 26 Jun 2003 17:36:38 +0200 |
User-agent: |
KMail/1.4.3 |
I have the following code:
#include "stdio.h"
#include "stdlib.h"
int main()
{
int **p;
int i;
p = (int **)malloc(2*sizeof(int *));
p[0] = (int *)malloc(10*sizeof(int));
p[1] = (int *)malloc(10*sizeof(int));
for(i = 0; i < 10; i++){
p[0][i] = i;
p[1][i] = i+20;
}
return 0;
}
And I was trying to display it in DDD. Through the following commands
p[0][0] @ 10
p[1][0] @ 10
I can show the right values
0|1|2|3|4|5|6|7|8|9
20|21|22|23|24|25|26|27|28|29
but if I try to show the whole 2D array through the command
p[0][0] @ 10 @ 2
I obtain something strange
0|1|2|3|4|5|6|7|8|9
0|49|20|21|22|23|24|25|26|27
The (0|49) are uninitialized values at the end of p[0][0].
Is this a bug?
Thank you
Leonardo Giordani
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Display of 2D dinamic arrays,
Leonardo Giordani <=