Trending Technology Machine Learning, Artificial Intelligent, Block Chain, IoT, DevOps, Data Science

Recent Post

Codecademy Code Foundations

Search This Blog

Contents of Arduino

Operators
  • Arithmetic Operators :  =, +, -, *, /, %
  • Comparison Operator :  ==, !=, <, >, <=,  >=
  • Boolean Operator :  &&, ||, !
  • Bitwise Operator :  &, |, ^, ~, <<,  >>,
  • Compound Operator : ++,  --,  +=,  -=, *=, /=, %=, |=, &=

Control Statement 

If statement
  •  if(condition){
             Statements if the
             condition is true ;
           }

If... Else statement
  •   If(condition) {
           statement if the 
           condition is true ;
          }
        else{
            Statements if the
            condition is false;
            }


If .... Elseif.....Else
  •  If (condition1){
            statements if the
            condition1 is true;
          }
            else if (condition2){
               Statements if the
               condition1 is false
               and condition2 is true;
            }
             else{
                Statements if both the
                 condition are false;
               }

Switch Case
  • Switch(choice)

       {
         case opt1: statement_1;break;
         case opt2: statement_2;break;
         case opt3: statement_3;break;
          .
          .
          .
          case default: statement_default; break;
        }

Conditional Operator.
  • Val=(condition)?(statement1):(Statement2)


Loops

For loop
  • for(initialize; condition;increment){

        Statement till the condition is true;
        }

While loop
  • while(condition){
        Statement till the condition is true;
       }

Do... While loop
  • do{

               Statement till the condition is true;
           } while(condition);

Nested loop : Calling a loop inside another loop

Infinite loop : Condition of the loop is always true, the loop will never terminate

Arrays
  • Collection of elements having homogenous datatype that are stored in adjacent memory location.
  • The conventional starting index is 0.
  • Declaration of array :
         <Datatype>array_name[size];
           Ex: int arre[5];
  • Alternative Declaration:

       int arre[]={0,1,2,3,4};
       int arre[5]={0,1,2}
  • Multi-dimentional array Declaration :
        <Datatype> array_name[n1] [n2] [n3]....;
        Ex: int arre [row] [col] [height];

String

Array of characters with NULL as termination is termed as a String.

Declaration using Array:

char str[] = "ABCD";
char str[4];


  • str[0]='A'
  • str[0]='B'
  • str[0]='C'
  • str[0]='0'
Declaration using String Object:
  • String str="ABC"  

Functions of String Object :
  • str.ToUpperCase() : change all the characters of str to upper case 
  • str.replace(str1,str2) : is str1 is the sub string then it will be replaced by str2
  • str.length(): returns the length of the string without considering null 


No comments:

Post a Comment

Popular Articles