1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-01-29 19:28:02 +01:00

Merge pull request #2169 from divayprakash/typos-fix2

[c/en] fixed whitespaces
This commit is contained in:
ven 2016-03-12 09:28:47 +01:00
commit ac76cf11dd

View File

@ -36,7 +36,6 @@ Multi-line comments don't nest /* Be careful */ // comment ends on this line...
enum days {SUN = 1, MON, TUE, WED, THU, FRI, SAT};
// MON gets 2 automatically, TUE gets 3, etc.
// Import headers with #include
#include <stdlib.h>
#include <stdio.h>
@ -114,7 +113,6 @@ int main (int argc, char** argv)
// sizeof(obj) yields the size of the expression (variable, literal, etc.).
printf("%zu\n", sizeof(int)); // => 4 (on most machines with 4-byte words)
// If the argument of the `sizeof` operator is an expression, then its argument
// is not evaluated (except VLAs (see below)).
// The value it yields in this case is a compile-time constant.
@ -130,7 +128,6 @@ int main (int argc, char** argv)
int my_int_array[20]; // This array occupies 4 * 20 = 80 bytes
// (assuming 4-byte words)
// You can initialize an array to 0 thusly:
char my_array[20] = {0};
@ -347,7 +344,6 @@ int main (int argc, char** argv)
this will print out "Error occured at i = 52 & j = 99."
*/
///////////////////////////////////////
// Typecasting
///////////////////////////////////////
@ -386,7 +382,6 @@ int main (int argc, char** argv)
// (%p formats an object pointer of type void *)
// => Prints some address in memory;
// Pointers start with * in their declaration
int *px, not_a_pointer; // px is a pointer to an int
px = &x; // Stores the address of x in px
@ -432,7 +427,6 @@ int main (int argc, char** argv)
printf("%zu, %zu\n", sizeof arraythethird, sizeof ptr);
// probably prints "40, 4" or "40, 8"
// Pointers are incremented and decremented based on their type
// (this is called pointer arithmetic)
printf("%d\n", *(x_ptr + 1)); // => Prints 19
@ -578,8 +572,6 @@ void testFunc2() {
}
//**You may also declare functions as static to make them private**
///////////////////////////////////////
// User-defined types and structs
///////////////////////////////////////
@ -696,6 +688,7 @@ typedef void (*my_fnp_type)(char *);
"%o"; // octal
"%%"; // prints %
*/
///////////////////////////////////////
// Order of Evaluation
///////////////////////////////////////
@ -786,4 +779,4 @@ Readable code is better than clever code and fast code. For a good, sane coding
Other than that, Google is your friend.
[1] http://stackoverflow.com/questions/119123/why-isnt-sizeof-for-a-struct-equal-to-the-sum-of-sizeof-of-each-member
[1] http://stackoverflow.com/questions/119123/why-isnt-sizeof-for-a-struct-equal-to-the-sum-of-sizeof-of-each-member