Re: C Pointer problem
- From: Richard Heathfield <invalid@xxxxxxxxxxxxxxx>
- Date: Wed, 31 May 2006 20:49:48 +0000
Default User said:
Markus wrote:
Hi,
I can't understand why this code causes a "memory read exception" at
int x=**a;
void pass(int** a)
{
int x=**a;
}
void main()
{
int arr[2][2]={{1,2},{3,4}};
pass(arr);
}
The assignment of int int x=**a in the main function works.
Did this really compile without any warnings or errors?
No.
foo.c:2: warning: no previous prototype for `pass'
foo.c: In function `pass':
foo.c:3: warning: unused variable `x'
foo.c: At top level:
foo.c:6: warning: function declaration isn't a prototype
foo.c:6: warning: return type of `main' is not `int'
foo.c: In function `main':
foo.c:8: warning: passing arg 1 of `pass' from incompatible pointer type
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
.
- References:
- C Pointer problem
- From: Markus
- Re: C Pointer problem
- From: Default User
- C Pointer problem
- Prev by Date: Re: C Pointer problem
- Next by Date: Re: Simplicity has a future
- Previous by thread: Re: C Pointer problem
- Index(es):
Relevant Pages
|