Tutorial by Examples

A typedef declaration has the same syntax as a variable or function declaration, but it contains the word typedef. The presence of typedef causes the declaration to declare a type instead of a variable or function. int T; // T has type int typedef int T; // T is an alias for int int A[1...
The rule that typedef declarations have the same syntax as ordinary variable and function declarations can be used to read and write more complex declarations. void (*f)(int); // f has type "pointer to function of int returning void" typedef void (*f)(int); // f is an alias for &...
The typedef keyword is a specifier, so it applies separately to each declarator. Therefore, each name declared refers to the type that that name would have in the absence of typedef. int *x, (*p)(); // x has type int*, and p has type int(*)() typedef int *x, (*p)(); // x is an alias for in...
C++11 The syntax of using is very simple: the name to be defined goes on the left hand side, and the definition goes on the right hand side. No need to scan to see where the name is. using I = int; using A = int[100]; // array of 100 ints using FP = void(*)(int); // pointer to...

Page 1 of 1