User Tools

Site Tools


cplusplus:c_versus_cplusplus

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
Last revisionBoth sides next revision
cplusplus:c_versus_cplusplus [2020/05/04 01:27] – [Defining variables] mithatcplusplus:c_versus_cplusplus [2020/05/04 01:40] – [Some C Resources] mithat
Line 82: Line 82:
 } }
 </code> </code>
-  * In older versions of C, you //must// define variables at the beginning of a function.+  * In older versions of C, you must define all variables at the beginning of a function.
   * Common practice today anyway.   * Common practice today anyway.
 ===== Prototypes ===== ===== Prototypes =====
Line 103: Line 103:
   * Best practice to use them anyway.   * Best practice to use them anyway.
 ===== Named constants and macros ===== ===== Named constants and macros =====
-  * ''const'' is available only in newer versions of C.+  * ''const'' modifier is available only in newer versions of C.
   * ''#define'' preprocessor directive typically used instead.<code c>   * ''#define'' preprocessor directive typically used instead.<code c>
 #define PI 3.1415 #define PI 3.1415
Line 119: Line 119:
 myDouble = (double)myInt/3;  /* cast myInt to a double */ myDouble = (double)myInt/3;  /* cast myInt to a double */
 </code> </code>
-  * No ''static_cast<>'', etc. 
   * Place the type you want a value cast to inside parenthesis before the value.   * Place the type you want a value cast to inside parenthesis before the value.
 +  * No ''static_cast<>'', etc.
 +
 ===== Dynamic memory ===== ===== Dynamic memory =====
   * Use ''malloc()'' and ''free()''.   * Use ''malloc()'' and ''free()''.
Line 156: Line 157:
 ===== Some C Resources ===== ===== Some C Resources =====
  
-  * [[https://www.math.brown.edu/~jhs/ReferenceCards/CRefCard.v2.2.pdf|C Reference Card (ANSI)]] +  * [[https://www.math.brown.edu/~jhs/ReferenceCards/CRefCard.v2.2.pdf|C Reference Card (ANSI)]] Highly recommended! 
-  * [[http://www.tutorialspoint.com/cprogramming/|C Tutorial]] from Tutorials Point+  * [[C examples|C code examples]]
  
 ===== C Examples ===== ===== C Examples =====
   * Look [[C examples|here]].   * Look [[C examples|here]].
cplusplus/c_versus_cplusplus.txt · Last modified: 2020/05/04 01:40 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki