First steps in programming

Joined December 2013
Photos and videos
Hexadecimal integer literals start with 0x in C and C and 0xDEADBEEF is a valid hexadecinal integer literal.
Null-terminated string is a character array whose last character is zero.
Actually you should use int8_t for numbers between -128 and 127 instead of char in C .
&& is a logical AND, but & is a bitwise AND. a && b returns 1 if a and b ar greater than 0, but a & b returns a number with AND-ed bits.
If n is not equal to 0 and (n-1)&n is equal to 0 (it has exactly one 1-bit), it is a power-of-two number. Full formula: n!=0 && (n-1)&n==0
Name mangling is used to "store" C function names is executables.
@19k86x @Yanthir follow me! I will teach you programming :)
long is 4 bytes on Windows, but 8 bytes on *NIX systems. To get 8 bytes on Windows, you have to write long long.
"for" loop can be actually written like this "for(;;)" and it is the same as "while(true)".
Did you know that somePointer[3] and somePointer 3 and 3[somePointer] are the same in C?
2
1
const int a = 10; means that you can not change the value of a.
A linked list is a list in which every element stores a reference to other (linked) element(s).
Scope is everything between {}. Variables declared in a scope are erased at the end of the scope. They are somehow popped from the stack.
Didn't know that if you call new int[10], then you have to call delete [] to release it. This caused me a lot of memory leaks.
In C you allocate memory with malloc, but in C with the new operator. You have to release memory with free and delete respectively.
Actually I could also use C cast like so "int foo = static_cast<int>(4.6f)"
"(int)4.6f" is a C-style explicit cast, but "int foo = 4.6f" has an implicit cast to int. Interesting...
1
Hmm, a function that calls itself is a recursion.
"int foo(char bar);" is a declaration of a function that has parameter of type char and returns int.
"using namespace std;" lets me write "string" instead of "std::string"!