C: Difference between revisions

Jump to navigation Jump to search
5 bytes removed ,  20 May 2022
no edit summary
(Created page with "C is a language made by Dennis Ritchie in 1972. Unlike alot of languages of today, C is not dynamic. There is no support for things like garbage collection, methods, operator overloading, dynamic types and generics. == Basic Data Types == *bool: 1 byte. despite being a boolean, it can actually store numbers up to 128. *int: 2 or 4 bytes. *float: 4 bytes and supports numbers with 6 decimal places. *double: 8 bytes and supports numbers with 15 decimal places. == Examples...")
 
No edit summary
 
int* b = (int*)malloc(sizeof(int)); //malloc returns a void* so we must cast it into a int*
*b = 80; //we must dereference it in order to access the value with a *
increment(&a);
increment(b);
printf("variable a: %i\nvariable b: %i\n", a, *b); //a will return 42 and b will return 81

Navigation menu