C programming in an easy way - An introductionsteemCreated with Sketch.

in #c9 years ago (edited)

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

  1. ! ( logic NOT)
  2. ++ (increase by 1 "+1"), -- (decrease by 1 "-1")
  3. *, /, % (module operator)
  4. +, -
  5. <, <=, >, >=
  6. == (logic equal), != (logic not equal)
  7. && (logic AND)
  8. || (logic OR)
  9. = (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.  

Sort:  

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 ;)

Coin Marketplace

STEEM 0.04
TRX 0.32
JST 0.084
BTC 60911.74
ETH 1565.41
USDT 1.00
SBD 0.47