cplusplus:c_vs._c
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
cplusplus:c_vs._c [2016/04/21 23:16] – [Dynamic memory is different] mithat | cplusplus:c_vs._c [2016/04/21 23:35] – [Structs] mithat | ||
---|---|---|---|
Line 78: | Line 78: | ||
===== Named constants and macros ===== | ===== Named constants and macros ===== | ||
* '' | * '' | ||
- | * ''# | + | * ''# |
#define PI 3.1415 | #define PI 3.1415 | ||
#define TAX_RATE 0.065 | #define TAX_RATE 0.065 | ||
Line 90: | Line 90: | ||
* Allocating memory:< | * Allocating memory:< | ||
int *x = malloc(sizeof(int)); | int *x = malloc(sizeof(int)); | ||
- | int *x_arr = malloc(sizeof(int) * 10); /* allocate array of ints */ | + | int *xArry = malloc(sizeof(int) * 10); /* allocate array of ints */ |
</ | </ | ||
* Deallocating memory:< | * Deallocating memory:< | ||
free(x); | free(x); | ||
- | free(x_arr); | + | free(xArry); |
</ | </ | ||
===== Structs ===== | ===== Structs ===== | ||
- | * Need to use '' | + | * You must use the '' |
struct MyStruct | struct MyStruct | ||
{ | { |
cplusplus/c_vs._c.txt · Last modified: 2016/04/22 01:10 by mithat