This blog is under construction

Monday, 30 December 2013

Pointer operators in C

There are two types of pointer operators.  They are
1. Address operator(&)
2. Indirection operator(*)

Address Operator:
It is used to get the address of the given  variable.  Consider the following,
Example:
int a = 10, *ptr;
ptr = &a;
Here, &a gives us the address of the variable and the same is address to pointer variable ptr.  Address operator is also known as reference operator.

Indirection operator:
It is used to get the value stored in an address.  Consider the following,
Example:
int a = 10, b, *ptr;
ptr = &a;  // referencing(&a)
b = *ptr;  // dereferencing(*ptr)
Here, ptr has the address of the variable a.  On dereferencing the pointer ptr, we will get the value stored at the address of a.

Example C program on pointer operators

  #include <stdio.h>
  int main() {
        int a = 10, b, *ptr;
        ptr = &a;  // referencing (&a)
        b = *ptr;  // dereferencing (*ptr)
        printf("Value of &a  is 0x%x\n", &a);
        printf("Value of ptr is 0x%x\n", ptr);
        printf("Value of a is %d\n", a);
        printf("Value of b is %d\n", b);
        printf("Value of *ptr is %d\n", *ptr);
        return 0;
  }


  Output:
  jp@jp-VirtualBox:~/$ ./a.out
  Value of &a  is 0xbfb1715c
  Value of ptr  is 0xbfb1715c
  Value of a is 10
  Value of b is 10
  Value of *ptr is 10



3 comments:

  1. Hello Everyone !

    USA SSN Leads/Dead Fullz available, along with Driving License/ID Number with good connectivity.

    All SSN's are Tested & Verified.

    **DETAILS IN LEADS/FULLZ**

    ->FULL NAME
    ->SSN
    ->DATE OF BIRTH
    ->DRIVING LICENSE NUMBER
    ->ADDRESS WITH ZIP
    ->PHONE NUMBER, EMAIL
    ->EMPLOYEE DETAILS

    *Price for SSN lead $2
    *You can ask for sample before any deal
    *If you buy in bulk, will give you discount
    *Sampling is just for serious buyers

    ->Hope for the long term business
    ->You can buy for your specific states too

    **Contact 24/7**

    Whatsapp > +923172721122

    Email > leads.sellers1212@gmail.com

    Telegram > @leadsupplier

    ICQ > 752822040

    ReplyDelete
  2. Dell Laptop Service center are giving repair service at the door. We should high quality Dell out of warranty Laptop Repair, removal of virus, screen removal, wireless network set up, battery removal, motherboard replacement to several other are offered at budget friendly price and it’s Negotiable. We can fix them all in time by our well experience and certified technicians. If you want to repair your laptop in front of your eyesight, than you may call us: 7217871051

    ReplyDelete
  3. NAME|SSN|DOB|DL|ADDRESS|EMAIL|PHONENUMBER|WORKHISTORY|ACCOUNTDETAILS
    Fresh Fullz & Fresh Spammed

    CCNUMBER|MM|YYYY|CVV|NAME|SSN|DOB|ADDRESS|EMAIL|PHONENUMBER
    CC fullz with CVV

    High Credit Scores Pros 700+
    EIN Business Fullz

    ICQ 752822040
    WA/TG +92 317 272 1122
    TG @leadsupplier
    Skype/Wickr @peeterhacks

    Spamming All fresh Tools & Tutorials
    Hacking Stuff
    Carding Methods & Cashout Methods
    Loan Methods
    SMTP's/RDP's/SHELLS/Brutes/C-panels
    Key-Loggers/Kali-Linux Full Package
    Courses for D**K/D**P Web
    SQLi Injector
    Combos/I.P's/Proxies
    Logs/HQ Emails

    ICQ/TG @killhacks
    WA +92 317 272 1122
    exploit.tools4u at gmail dot com

    ReplyDelete