Function Pointers (ambigous syntax)

时间:2015-05-12 22:38:56

标签: c function pointers

I was hoping someone could clear up a question I have about the correct way to reference function pointers. Or clarify the difference in usage.

The majority of literature I've seen (including http://en.wikipedia.org/wiki/Function_pointer#Example_in_C ) declares and references pointers (using the SINE function for example) like

let attributes = NSFileManager.defaultManager()
     .attributesOfItemAtPath(filePath, error: nil) as NSDictionary?
let fileSize : UInt64 = attributes!.fileSize()

However, a number of other sites (including http://en.wikipedia.org/wiki/Callback_(computer_programming) and http://www.cprogramming.com/tutorial/function-pointers.html) reference them such as

double (*fnPtr)(void) = sin;

I admit my interpretation based on the wiki pages listed above may be incorrect so any clarification would be greatly appreciate.

Thanks, Jeff

0 个答案:

没有答案