C programming in an easy way - An introduction
Hello my name is mrdk and i'm gonna start posting about C programming! We will refer to the basics of C language for start and in time we gonna see more advanced functions.
Recommended application : DevC++ , CodeBlocks
Basic types data
Variables
- int (integer) [ -1, 1, 2, 3,..., 100, etc.]
- float (a single-precision floating point value)
- double (a double-precision floating point value)
- char (character) ['a', 'b','c' etc.]
Operators
- ! ( logic NOT)
- ++ (increase by 1 "+1"), -- (decrease by 1 "-1")
- *, /, % (module operator)
- +, -
- <, <=, >, >=
- == (logic equal), != (logic not equal)
- && (logic AND)
- || (logic OR)
- = (assignment operator)
Output/ Input to the console
Output to the screen monitor
printf("alphanumeric/s",parameter1,parameter2,...);
For integers :
For floats or doubles :
For characters :
For strings :
Input from keyboard
scanf("alphanumeric",address1,address2,...);
For integers :
For floats or doubles :
For double variables we use the alphanumeric %lf
For characters :
For strings :
Let's see a completely programm
- // inline comments in C
- /* comments that can take more than 1 line */
- #include <stdio.h>: Always on top, we write this sentence ! Statement which tells the compiler to include the contents of stdio
- int main() { } : This is the main function in C . All attributes have to pass through the main() to be executed.
- All the declerations have to end with ( ; )
** All the C programs have .c at the end (eg. myprogram.c)
Things we have learnt
- Operators & Variables in C
- How to show also messages and attributes in the console
- How to read attributes from the keyboard
- How a C program works
**Be ware on spaces in scanf() and dont forget the ( ; ) at the end of a sentence!**
That's all for today ! In my next post i will refer to if-statements and in loop types we have in C.










Nice job and welcome to Steemit!
You should try posting it in "programming" first by placing it as the first tag that specifies the category :)
You got a Resteem from me ;)