Skip to content

Latest commit

 

History

History
65 lines (53 loc) · 2.24 KB

README.md

File metadata and controls

65 lines (53 loc) · 2.24 KB

C PROGRAMMING NOTES

IDE:

Helps us in writing codes by correcting our methods etc... for eg VSCode

Compiler:

Helps to run the code and convert it into machine language for our CPU to understand it... for eg mingw

THINGS IN C CODE:

  • pre prcessor commands - #include<stdio.h>... studio.h file ki necessity hai is program me so vo vali file include kro
  • funtions - int main()... program ko break krne ke liye use hota hai taki alg alg cheeze perform kr pae int main() alg hota hai coz vaha se program ka execution shuru hota... main isme function ka name hai and int ye function return krta hai, ye dusre functions ko call krta hai taki dusre functions return me answer krte hai
  • variables
  • statements
  • expressions
  • comments

Steps that happen while running a command:

  • Pre processing
  • Compilation
  • Assembly
  • Linking
  • Loading

What is variable:

  • A name given to a memory location
  • Declared by writing type variable_name
  • Initialized and declared by type variable_name = value;

RULES FOR VARIABLES:

  • Can contain alphabets, digits, and underscore
  • A variable name can start with an alphabet and undercore only
  • Can't start with a digit
  • No whitespace & reserved keywords is allowed
  • Valid varibles names: int anshul, float anshul123, char _anshul34
  • Invalid variable name: $anshul, int 77anshull , char long;

Data types in c:

  • Basic data type: int, char, float, double
  • Dervied data type: array, pointer, structure, union
  • Enumeration data type: emun
  • Void data type: void

OPERATOR:

An operator is a symbol used to perform operations in given programming language

Types Of If Else Statement (CONTROL STATEMENT):

  • If statement
  • If Else statement
  • If - Else If ladder
  • Nested If

Rules for Switch Statement:

  • Switch expression must be 'int' or 'char'
  • Case value must be an integer or a char
  • Case must come inside switch
  • Break is not a must

Types of Loops:

  • Do While Loop
  • While loop
  • For Loop

Properties of Expressions in for loop:

  • 1 we can initialize more than 1 variable at a time
  • Putting expression in code is option and not a must task