Following our last thread https://steemit.com/c/@debuglove/a-small-introduction-to-c, we will continue with a small code so you can format better your text and write well documented code.
In our last example lets suppose we would like to print. Hello "nice" Reader at the screen. Ops, what happened, is the compiler nuts? Nah. What happened is simply the word "nice" wont be on the escope of the function, and the compiler doesnt understand what "nice" means. thats where our escape sequences and character escapes enter in action. To solve this problem all we had to do is replace the code:
\' - writes a character literal for the character '.
\\ - writes a stringfied backslash so it wont be interpreted as a escape sequence
\a - rings the terminal bell of your CPU
\b - backspace character
\f - formfeed character
\n - newline character
\r - carriage return character
\t - horizontal tab character
\v - vertical tab character
But one image is worth a thounsand words. So lets take a small peek
Our vertical tab and formfeed characters are relics of and old era, which would help you format text in printers. So chances are you wont need them very much.
Now, everything looks neat, but good code needs be well documented, and we cant do that at the software or console application itself can we?
We can do it commenting just one line:
lines
Commenting */
Everything after the single line commenting or inside the multiple lines commenting characters, will be ignored by the compiler. And now, you can comment and document your code at your favorite IDE.
To complete our introduction lesson today we will take a brief look at how we can identify the data types we create in C. Our native C datatypes, will contain different types of data, like a text, a number or a fraction. But we cant just assign that value to the C datatype, like:
Identifiers cannot start with a number digit, but may contain underscore. Also you may not use the C reserved keywords as identifiers:
auto else long switch break enum register typedef
case extern return union char float short unsigned
const for signed void continue goto sizeof volatile
default if static while do int struct _Packed
double
Im going a bit slow, since im also still learning and getting used with steemit and its format style.
Next class, we will go a little deeper into C data types.
See you soon!