dubbeat
dubbeat

Reputation: 7847

What does the "&" character mean prepended to a var in obj-c

HI,

Consider these method calls

1) AudioFileOpenURL(inFileURL,kAudioFileReadPermission,kAudioFileMP3Type,fileID)

2) AudioFileOpenURL(inFileURL,kAudioFileReadPermission,kAudioFileMP3Type,&fileID)

The second call has an "&" symbol before the fileID parameter. What does the "&" mean?

Upvotes: 0

Views: 170

Answers (2)

Maxpm
Maxpm

Reputation: 25551

I believe it has to do with pointers. I forget if it's properly called a constructor or deconstructor operator, but it can be read as "the memory address where fileID is."

Upvotes: 0

Ole Begemann
Ole Begemann

Reputation: 135540

That's not an Objective-C feature. It's the C "address of" operator. It gives you the memory address of the variable as opposed to its contents.

Upvotes: 4

Related Questions