programming_languages:cpp:pointer

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
programming_languages:cpp:pointer [2017/02/19 15:46] – ↷ Seite von programmiersprachen:cpp:pointer nach programming_languages:cpp:pointer verschoben phreazerprogramming_languages:cpp:pointer [2017/10/05 02:24] (current) – [Function pointer] phreazer
Line 148: Line 148:
 (*psSomething).nValue = 5; (*psSomething).nValue = 5;
 psSomething->nValue = 5; psSomething->nValue = 5;
 +</code>
 +
 +===== Function pointer =====
 +
 +<code cpp>
 +// Pointer f to a function, which returns void and has no parameters
 +void (*f) (void)
 +// Pointer f to a function, which returns a void pointer and has a void pointer as parameter
 +void *(*f)(void *)
 +// Function can be called like this:
 +f();
 +// Pointer func2, which returns a pointer to a char and takes a pointer to a const char and an int as a parameter.
 +char * (*func2)(const char *, int) = strchr;
 </code> </code>
  • programming_languages/cpp/pointer.1487515591.txt.gz
  • Last modified: 2017/02/19 15:46
  • by phreazer