Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Once again poin...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 26097 of 26198
Post > Topic >>

Once again pointer to first element vs pointer to array cast to

by Szabolcs Borsanyi <borsanyi@[EMAIL PROTECTED] > May 6, 2008 at 11:46 PM

I know that this topic has been discussed a lot, still I'd appreciate
a clear cut (and correct) answer:
I pass a multidimensional array to a function, which is defined as
int f(int a[10][10])
{
  int *b=(void*)a;
  int *c=a[0];
  /*...*/
}
Now the questions come:
- Is it guaranteed that b and c points to the same object (or is this
implementation defined)?
- Is it always true that a[1][1] refers to the same object as c[11] ?
(There is no hole)
- Does dereferencing b violate any aliasing rule?

Thanks
Szabolcs




 3 Posts in Topic:
Once again pointer to first element vs pointer to array cast to
Szabolcs Borsanyi <bor  2008-05-06 23:46:56 
Re: Once again pointer to first element vs pointer to array cast
pete <pfiland@[EMAIL P  2008-05-07 07:19:33 
Re: Once again pointer to first element vs pointer to array cast
Barry Schwarz <schwarz  2008-05-07 22:40:39 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 6:49:40 CDT 2008.