Re: C Pointer problem
- From: Richard Heathfield <invalid@xxxxxxxxxxxxxxx>
- Date: Wed, 31 May 2006 16:53:14 +0000
Markus said:
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()
main returns int.
If you can't even get the entry point right, what chance do you stand with
pointers?
{
int arr[2][2]={{1,2},{3,4}};
pass(arr);
pass() takes int **.
arr's value is taken as the address of its first element. Its first element
is an int[2] array, so the address of its first element has type int
(*)[2], which is not the same as int **.
--
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
- C Pointer problem
- Prev by Date: Re: Simplicity has a future
- Next by Date: Re: Help is need immidiately
- Previous by thread: C Pointer problem
- Next by thread: Re: C Pointer problem
- Index(es):
Relevant Pages
|