Changes between Version 17 and Version 18 of ResumedC


Ignore:
Timestamp:
May 17, 2009, 10:55:30 PM (16 years ago)
Author:
Leo Fortey
Comment:

slight grammar edit.

Legend:

Unmodified
Added
Removed
Modified
  • ResumedC

    v17 v18  
    11[[TOC]]
    22
    3 ,,'''Note''': This is not pretended to be a Howto, also not really ''public'', it is just a page that i have used to take some notes of a interesting book of C that im reading, you are allowed to edit and correct this document if you see anything wrong, also order it a bit or made it better, but this not pretends to be a ''big'' document so try to maintain it compact. Thanks,,
     3,,'''Note''': This is not pretended to be a Howto, also not really ''public'', it is only a page that I have used to take some notes of an interesting book of C that I'm reading. You are allowed to edit and correct this document if you see anything wrong, also order it a bit or make it better, but this not pretended to be a ''big'' document so try to maintain it compact. Thanks,,
    44----
    55
     
    88=== Comments ===
    99
    10 The comments are very important for yourself basically, you need to comment all your functions and declarations, and specially you need to comment your variables in order to know *what* exactly they are, and also for know possible special things of these variables
    11 
    12 It is recommended to learn how works '''doxygen''' (5 minutes reading a howto in google, it is very basic) so that you can know special techniques to comment your source code that then you can build ''documentation'' of your API/source directly from these comments
     10The comments are very important for yourself. Basically, you need to comment all your functions and declarations and especially your variables in order to know *what* exactly they are and to remember the special things about these variables.
     11
     12It is recommended to learn how '''doxygen''' works (5 minutes reading a howto in google, it is very basic) so that you know special techniques about commenting your source code. This will aid in build proper ''documentation'' of your API/source directly from these comments
    1313
    1414The special things that you need to have in mind when you code is: clarity of code, simplicity, and summary
     
    5757if (var == 0)
    5858}}}
    59  ,,Maybe this sounds strange by doing this on this way, but if ''var'' is equal to 0, then the result of the '''()''' is 1 (true), if you don't understand why is 1 or how this works, you need to start reading a new book of C again.,,
     59 ,,Maybe this sounds strange by doing it this way but if ''var'' is equal to 0, then the result of the '''()''' is 1 (true), if you don't understand why is 1 or how this works, you need to start reading a new book of C again...,,
    6060
    6161
     
    8686}}}
    8787
    88 The ''counters'' of the arrays start by 0, so if you need to create an array of 4 elements you need to declare 4 and use them from 0 to 3, this maybe sound strange:
     88The ''counters'' of the arrays start by 0, so if you need to create an array of 4 elements you need to declare 4 and use them from 0 to 3, this may sound strange:
    8989 * This maybe sound strange, like ''why i need to declare 4 then instead of 3 ?'': simple, because you are declaring 4, and you still having 4 (0 to 3 = 4)
    9090
     
    9999If you need a ''Global variable''' in your entire code, you need to declare them out of any function
    100100
    101 Everytime you enclose a variable declaration inside a block '''{}''', it is limited to this section (not works out of it), if you have variables declared out of any function and/or out of main(), it is supported by all the entire application. Also, if you declare a variable inside a block that is already declared outside of it, then for inside the block it is used only the new declared one, not the one declared out of it, however, this practice is not good since may be very confusing.
     101Every time you enclose a variable declaration inside a block '''{}''', it is limited to this section (will not work outside of it). If you have variables declared out of any function and/or out of main(), it is supported by all the entire application. Also, if you declare a variable inside a block that is already declared outside of it, then for inside the block it is used only the new declared one, not the one declared out of it, however, this practice is not good since may be very confusing.
    102102
    103103'''signed''': means ''with sign'', so, values negative and positive, for example if the '''char''' variable has a limit of 255 values, using the '''sign''' mode we can use from '''-128''' (negative) to '''127''' (positive), and using '''unsigned''' we can use from '''0''' to '''255'''
     
    107107
    108108==== Static ====
    109 You can use ''static'' inside a function or outside it, it has two differents meanings:
     109You can use ''static'' inside a function or outside it, it has two different meanings:
    110110     * Inside a function: You can ''pre'' set a value to a variable ''(static int foo = 5)'', then the first time you enter on the function it will be set to 5, but the next times it not set again, it just remember the last value used
    111111     * Outside a function (global mode): You will use it only in the actual file (compilation unit), good for optimization but you can't use it on other files
     
    278278
    279279==== Double pointers ====
    280 The double pointer can be used for 2 differents things:
     280The double pointer can be used for 2 different things:
    281281 * A pointer that points to a pointer, so that you can change the value of the original pointer (address value)
    282282   * ''To modify the value of a variable using pointers in a function, you need to pass the address of that variable'': Same thing when you try to modify the address of a pointer (pointer of a pointer)
     
    406406 * The book of C by Kernighan & Ritchie
    407407 * Practical C Programming (very good to understand correctly C and do good practices on it) in o'reilly
    408  * Mastering C Algorithms (advanced C) in o'reilly
     408 * Mastering C Algorithms (advanced C) in O'Reilly
    409409
    410410== References ==