Pointer In C++

pointer
pointer

Pointer In C++:-

In this article I have explained Pointer in c++ in detail with effective way.You will like it , I know about it. So enjoy it lovely friends. The concept of pointer  in c++ is most important to get c++ in detail.

Pointer:-

It is a variable contains the address of another variable of same type. Pointer is a special type of variable.

If we want to Store the address of ’int’ Type variable then we have to take ‘int’ type of pointer variable.

Pointer Variable Declaration Statement:-

Syntax ,

DataType         * VariableName;

In this Statement, we declare the data type and the name of a Pointer variable.

Example,

int    *ptr;

Initialization of a Pointer:-

To initialize a Pointer variable, first of all we have to declare the same type of a Simple variable.

Example,

int a;

a=10;

Now we have to do initialization of example  Pointer,

ptr=&a;

By above Statement ’ptr’ is initialized,the address of variable ‘a’

If we want to display the value of a then we can write,

cout<<*ptr;

Output,   10

By above example it is declared that Pointer ‘ptr’ now indicating the variable ‘a’ and showing the value of a.

//Program to show the use of a pointer.

#include<iostream.h>

#include<conio.h>

void main ()

{

clrscr ();

int a,*ptr;

a=5;

ptr=&a;

cout<<”the value of variable”<<a;

cout<<” The value of a variable by pointer”<<*ptr;

cout<<”The address of a variable “<<ptr;

getch();

}

Output:-

The value of variable:-5

The value of a variable by Pointer:-5

The address of a variable:- EH5326 (It may any address)

Address of operator (&):-

The operator is used to get the address of a variable. If we want to get the address of a variable namely ‘a’ then we have to write the following Statement.

&a

After this we put it into the same type of variable of Pointer type.

ptr=&a;

Assignment  Operator(=):-

This operator is used to assign a value to a  variable like following Statement.

(1) b=a;

(2) a=5;

In (1) Example the value of ‘a’ is going into variable ‘b’ in

(2) example 5 is putting in variable ‘a’.

 Pointer To A Pointer :-

A variable declared in a Program is assigned an address. A Pointer variable also has an address. Pointer to a Pointer means that a variable can be declared which can store the address of Pointer variable.

//Program to Show the use of ‘Pointer to a Variable’.

#include<iostream.h>

#include<conio.h>

void main ()

clrscr ();

int a=10,   *ptr1, **ptr2;

ptr1=&a;

ptr=&ptr1;

cout<<” The value of a variable is:-”<<a<<”in”;

cout<<”The value of a variable by ptr1 is ”<<*ptr<<”/n”;

cout<<”The value of a variable by ptr2 is”<<**ptr2;

getch();

}

pointer
pointer

I know you will like this post very much.After getting it in your mind please tell me, how it was? Like this post I will provide all stuff like Computer Science , Mathematics , Technology  , Meditation etc.

You Also Can See More Result By Using Google Search.

You Also Can Play Online Quiz by following Link,

Computer Science

You Also Can Ask and Give Answer of Questions by following Link,

Questions

If you have any requirements to know more about it in detail, then this content may be helpful to you.

You Also Can Visit For More Knowledge In C++:-

Visit Your YouTube  Channel:-  Think , About It

Visit Your Website :- www.atozlives.com

Thanks,

“Play With All Computer Science , Mathematics  And Technology.”

 

 

36 COMMENTS

  1. Thanks for your write-up. One other thing is that if you are selling your property yourself, one of the problems you need to be cognizant of upfront is just how to deal with house inspection reviews. As a FSBO seller, the key concerning successfully transferring your property plus saving money upon real estate agent income is expertise. The more you are aware of, the easier your property sales effort will likely be. One area in which this is particularly essential is assessments.

  2. Interesting article. It is extremely unfortunate that over the last ten years, the travel industry has already been able to to deal with terrorism, SARS, tsunamis, flu virus, swine flu, and also the first ever true global economic collapse. Through all of it the industry has proven to be robust, resilient and dynamic, getting new strategies to deal with trouble. There are always fresh problems and opportunities to which the industry must all over again adapt and act in response.

  3. Someone essentially help to make seriously posts I would state. This is the first time I frequented your web page and thus far? I amazed with the research you made to make this particular publish extraordinary. Magnificent job!

  4. Thanks on your marvelous posting! I definitely enjoyed reading it, you happen to be a great author.I will make certain to bookmark your blog and will eventually come back at some point. I want to encourage that you continue your great posts, have a nice evening!

  5. Thanks for your helpful post. Through the years, I have come to understand that the particular symptoms of mesothelioma cancer are caused by the build up associated fluid between your lining in the lung and the torso cavity. The sickness may start in the chest spot and distribute to other areas of the body. Other symptoms of pleural mesothelioma cancer include fat loss, severe breathing trouble, fever, difficulty ingesting, and swelling of the face and neck areas. It must be noted that some people living with the disease usually do not experience almost any serious indicators at all.

  6. When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several e-mails with the same comment. Is there any way you can remove me from that service? Cheers!

  7. Have you ever considered writing an ebook or guest authoring on other blogs? I have a blog based on the same topics you discuss and would really like to have you share some stories/information. I know my subscribers would value your work. If you’re even remotely interested, feel free to shoot me an e mail.

  8. Have you ever thought about writing an e-book or guest authoring on other sites? I have a blog based upon on the same information you discuss and would really like to have you share some stories/information. I know my readers would appreciate your work. If you’re even remotely interested, feel free to send me an e-mail.

  9. Thanks for discussing your ideas. Another thing is that learners have a selection between federal government student loan and a private student loan where it truly is easier to decide on student loan debt consolidation reduction than over the federal student loan.

  10. A further issue is that video games usually are serious anyway with the key focus on understanding rather than enjoyment. Although, we have an entertainment facet to keep your children engaged, each game is normally designed to work towards a specific expertise or course, such as mathmatical or scientific disciplines. Thanks for your publication.

  11. Its like you read my mind! You seem to know so much about this, like you wrote the book in it or something. I think that you can do with a few pics to drive the message home a little bit, but instead of that, this is great blog. An excellent read. I will certainly be back.

  12. Thanks for another informative web site. Where else could I get that type of info written in such an ideal way? I’ve a project that I’m just now working on, and I have been on the look out for such info.

  13. Excellent post. I was checking continuously this blog and I
    amm impressed! Extremely useful information. I care for such information a
    lot. I was looking ffor this certain information foor a very
    long time.Thank you and good luck.

  14. Nice post. I was checking continuously this blog and I am impressed!

    Very useful info specially the ultimate part 🙂 I handle such
    information much. I used to be seeking this particular information for a very long time.
    Thanks and best of luck.

  15. An intriguing discussion is worth comment.
    There’s no doubt that that you should write more about
    this topic, it may not be a taboo matter but typically folks don’t discuss such topics.
    To the next! All the best!!

  16. Hey would you mind sharing which blog platform you’re using?
    I’m going to start my own blog in the near future but I’m having a tough time
    choosing between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your layout seems different then most
    blogs and I’m looking for something unique. P.S My apologies for getting off-topic but I had
    to ask!

  17. Whats up this is somewhat of off topic but I was wanting
    to know if blogs use WYSIWYG editors or if you have to manually
    code with HTML. I’m starting a blog soon but have no
    coding experience so I wanted to get guidance from someone
    with experience. Any help would be greatly appreciated!

  18. Hello, i read your blog from time to time and i own a
    similar one and i was just wondering if you get a lot of
    spam feedback? If so how do you prevent it, any plugin or
    anything you can suggest? I get so much lately it’s driving me crazy so any help is very much appreciated.

  19. I don’t even know how I ended up here, but I thought this post was good.
    I don’t know who you are but certainly you are going to
    a famous blogger if you aren’t already 😉 Cheers!

  20. Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog that automatically tweet my newest twitter updates.
    I’ve been looking for a plug-in like this for quite some time and was hoping maybe
    you would have some experience with something like this.
    Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new
    updates.

  21. Good day very cool web site!! Man .. Beautiful ..

    Amazing .. I will bookmark your blog and take the feeds additionally?
    I’m glad to find numerous useful info right here in the publish, we
    want develop more techniques in this regard, thank you for sharing.
    . . . . .

  22. I have observed that of all forms of insurance, health care insurance is the most marked by controversy because of the conflict between the insurance coverage company’s necessity to remain making money and the buyer’s need to have insurance. Insurance companies’ revenue on wellness plans are extremely low, as a result some businesses struggle to gain profits. Thanks for the strategies you discuss through your blog.

LEAVE A REPLY

Please enter your comment!
Please enter your name here