Difference between revisions of "Typedef"

From Tux
Jump to: navigation, search
(Created page with "'''<code>typedef</code>''' can be used to rename a data type. <source lang="cpp"> typedef unsigned long int myint; // The following two variable declarations are equivalent...")
 
 
Line 1: Line 1:
'''<code>typedef</code>''' can be used to rename a data type.
+
'''<code>typedef</code>''' can be used to rename a data type.  The last identifier is the renamed type, while everything between <code>typedef</code> and it is what it can be used in place of.
  
 
<source lang="cpp">
 
<source lang="cpp">

Latest revision as of 13:23, 27 January 2018

typedef can be used to rename a data type. The last identifier is the renamed type, while everything between typedef and it is what it can be used in place of.

typedef unsigned long int myint;

// The following two variable declarations are equivalent given the above typedef
unsigned long int x;
myint x;

typedef statements can be made global.