2D array
-
I don't think my query(on C) is directly related to this board..however i post it here cos of urgency... I wrote: -------------------------- #include void fun(int** x) { printf("%d",**x); } int main(void) { int a[2][2]={1,2,3,4}; fun(a); return 0; } -------------------------- to get '0' as output and not '1',i.e.the 1st element in the array. I ran this on TC 2.01. Help me if this is buggy. Thanx!
-
I don't think my query(on C) is directly related to this board..however i post it here cos of urgency... I wrote: -------------------------- #include void fun(int** x) { printf("%d",**x); } int main(void) { int a[2][2]={1,2,3,4}; fun(a); return 0; } -------------------------- to get '0' as output and not '1',i.e.the 1st element in the array. I ran this on TC 2.01. Help me if this is buggy. Thanx!
ramamaru wrote:
to get '0' as output and not '1',i.e.the 1st element in the array.
How are you expecting to get '0' as an output. The array has four elements, none of which are '0'.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
-
I don't think my query(on C) is directly related to this board..however i post it here cos of urgency... I wrote: -------------------------- #include void fun(int** x) { printf("%d",**x); } int main(void) { int a[2][2]={1,2,3,4}; fun(a); return 0; } -------------------------- to get '0' as output and not '1',i.e.the 1st element in the array. I ran this on TC 2.01. Help me if this is buggy. Thanx!
-
I don't think my query(on C) is directly related to this board..however i post it here cos of urgency... I wrote: -------------------------- #include void fun(int** x) { printf("%d",**x); } int main(void) { int a[2][2]={1,2,3,4}; fun(a); return 0; } -------------------------- to get '0' as output and not '1',i.e.the 1st element in the array. I ran this on TC 2.01. Help me if this is buggy. Thanx!
ramamaru wrote:
to get '0' as output and not '1',i.e.the 1st element in the array.
but there is no zero In Array Inisialization List!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You
-
ramamaru wrote:
to get '0' as output and not '1',i.e.the 1st element in the array.
but there is no zero In Array Inisialization List!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You
-
In case you still need help: I recommend reading this article which answered all my questions on arrays in the past. Statically- and dynamically-allocated arrays are stored differently - keep this in mind and it will help you to find the solution to your problem. Good luck, Sebastian ------------------------------------------- My website: http://www.hartwork.org