diff --git a/docs/languages/c/c.md b/docs/languages/c/c.md index f8d7e03..37d1793 100644 --- a/docs/languages/c/c.md +++ b/docs/languages/c/c.md @@ -316,13 +316,6 @@ string.c_str(); //reads string char by char string.find(substring); // The zero-based index of the first character in string object that matches the requested substring or characters ``` -## Vectors - -```c -#include -vector vector_name = {values}; //variable length array -``` - ## Decision Statements ### If Statements @@ -402,15 +395,20 @@ It is possible to declare functions **after** the main only if the *prototype* i To return multiple variables those variables can be passed by reference so that their values is adjourned in the main. ```c -type function_name(type argument1, ...); // function prototype +// function prototype (usually in a .h file) +type function_name(type argument1, ...); -type functionName (parameters) { +// function implementation (usually in a .c file) +type function_name (parameters) { return ; } -void functionName (parameters) { } +// function without a return value +void function_name (parameters) { } ``` +> **Note**: annotatic a function with `static` makes it visible only inside the file in which is implemented/declared + ### Arguments passed by reference without pointers Passing arguments by reference causes modifications made inside the function to be propagated to the values outside. @@ -421,9 +419,9 @@ type functionName (type &argument1, ...) { //code here return ; } -``` -`functionName (arguments);` +function_name (argument_1, ...); +``` ### Arguments passed by reference with pointers @@ -435,9 +433,9 @@ type function_name (type *argument_1, ...) { instructions; return ; } -``` -`function_name (&argument_1, ...);` +function_name (&argument_1, ...); +``` ## Arrays