0

Currently, I'm starting an iphone application development. So, I have to retrieve my C knowledge back ( which wasn't good, got F twice back at the collage )

After I went to several tutorials and books, I notice something,

1. MyClass* myInstance
2. MyClass *myInstance
3. (MyClass *)myInstance

So far as I know, all of those are pointer (If I'm not misunderstanding). But what is the different between each of them. Or, they are just the same but define in different ways.

Tar_Tw45
  • 3,122
  • 6
  • 35
  • 58

1 Answers1

4

1, 2 no difference - depends on which style you prefer.

3 could be either a method declaration or the syntax for casting (thanks rob mayoff).

Method declaration: https://stackoverflow.com/a/683290/187954

Casting: https://stackoverflow.com/a/690760/187954

Community
  • 1
  • 1
Michael Robinson
  • 29,278
  • 12
  • 104
  • 130