39.(C++) >>>>tricks+pointer

 #include<bits/stdc++.h>

using namespace std;


#define ll unsigned long long 


int main(){

    

     /*                         !!!!Theory!!!

     

     a postiver number can be represented by the distinct summation of 

     some number which are  power's of 2.

     

     example :27--->>>2^4+2^3+2^1+2^0.

     special case :16--->>>2^4.

      

     

     */

    //  ll x=5;

    //  ll *ptr;

    //  ptr=&x;

    //  cout<<ptr<<endl;// address.

    //   *ptr=2;// changing x value  by using its address.

    //   cout<<*ptr<<endl;// *ptr for printing value in that address .

    //  cout<<x<<endl;

    ll x=5;

    ll *p,*q;

    p=&x;

    q=p;

    *q=10;

    cout<<*p;

       

    return 0;

}

Comments