OPERATIONS ARITHMETIC & LOGIC OPERATIONS WITH POINTERS

A pointer variable can only do arithmetic operations with integer values ​​only. Commonly performed operation is addition and subtraction operations. The addition operation with a value showing the location of the next data (index hereinafter) in memory. So did the reduction operation.


      # include <iostream>
# include <conio.h>

    void main () {
     Int value [3], * pointer;
   clrscr ();
   value [0] = 125;
   value [1] = 345;
   value [2] = 750;
   pointer = & value [0];

   court <<"\ t \ tSlamet Islan Al Hidayah" <<endl;
   court <<"\ t \ t 10018075" <<endl;
   court <<endl;
   court <<"Operation Arithmetic & Logic Operations" <<endl;
   court <<endl;
   court <<"Value" <<* pointer <<"at memory address" <<pointer <<"\ n";
   court <<"Value "<<*( pointer +1) <<" at memory address "<<pointer +1 <<" \ n ";
   court <<"Value "<<*( pointer +2) <<" at memory address "<<pointer +2 <<" \ n ";

getch ();
}
Output :



     A pointer can also be charged if the logic operation.

# include <iostream>
# include <conio.h>

   void main ()
   {Int a = 100, b = 200, * pa, * pb;
   clrscr ();
   pa = &a;
   pb = &b;

   court <<"\ t \ tSlamet Islan Al Hidayah" <<endl;
   court <<"\ t \ t 10018075" <<endl;
   court <<endl;
   court <<"Operation Arithmetic & Logic Operations" <<endl;
   court <<endl;
   court <<"pa value =" <<pa <<"value pb =" <<pb <<"\ n";
   if (pa <pb)
   court <<"Pa pointing to lower memory than Pb \ n";
   if (pa == pb)
   court <<"Pa points to the same memory with Pb \ n";
   if (pa> pb)
   court <<"pa refers to the memory higher than pb \ n";

getch ();
}

Output :



Well that's the program that I can make,,,,,!
If there are less jelass know any mistake, do not hesitate to leave a comment ataun advice. So that I can fix it later terimakasihh over his visit,,
Regards super ..

 




0 Response to " OPERATIONS ARITHMETIC & LOGIC OPERATIONS WITH POINTERS "