Quantcast
Channel: User Peter - Reinstate Monica - Stack Overflow
Viewing all articles
Browse latest Browse all 227

Comment by Peter - Reinstate Monica on What is the purpose of (int *) p here?

$
0
0
@Ry- Mistake or intention -- in any case it is (like most code involving pointers to arrays) rather unidiomatic and unnecessarily complicated. int *pint = s[i]; would be more common: s[i] is an array of 2 ints which decays to a pointer to the first element (which is a single int) when used in a context other than the operand of sizeof or &. Sure, &s, s and *s all have the same numerical value and it is with arguably all implementations known to mankind safe to arbitrarily cast between these types. But that doesn't mean one should, or that it is conformant.

Viewing all articles
Browse latest Browse all 227

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>