Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

16
  • How does it differ from a cast? Commented Oct 4, 2015 at 16:59
  • @nerdistcolony: It is not a cast, but belongs to the braces. The contents between the braces is not cast to the given type, but tells the compiler the type of the parentethised(!;-) construct. A cast is an expression. Commented Oct 4, 2015 at 17:01
  • Thanks for the insight. I'm going to have to read up on how C treats initialization and assignment statements. Commented Oct 4, 2015 at 17:04
  • @BLUEPIXY: I edited. Thanks again for the correction. I normally use this with structs only, so I forgot in the first place. Commented Oct 4, 2015 at 17:10
  • @Olaf - I tried an example with int pointers and I can't figure out how to make it work. Can you show how I would initialize an array of pointers using that technique? I tried 'casting' as (int **), (int *), (int *[]) ... nothing worked: ideone.com/b6R5cy, also ideone.com/b6R5cy Commented Oct 4, 2015 at 17:18