Pointers in C Programming [Complete Guide]

pointers in c programming

Pointer is one of the most important concepts in C Programming and it is very difficult to master in Pointers.

Pointers are just like variables. We can declare a pointer of any data type (int, char, float, double) just like we declare variables.

If we declare a variable of int, then that variable can contain only integer value or if we declare a variable of char then that variable can contain the only character in it.

The same concept is here with just one difference.

What are Pointers?

Pointers are variables whose values are memory addresses. Pointers only point to variables.

We can declare a pointer of any data type, if we declare a pointer of integer then that pointer can contain the address of an integer variable or if we declare a pointer of character then that variable can contain the address of any character variable.

In short, variables can contain the values directly and pointers can contain the addresses of that variables.

Declaration of a Pointer:

If we declare a variable and put an asterisk before variable name then that variable becomes a pointer just like that
int *numberPtr;
Here, numberPtr is a pointer of int and can contain the address of an integer variable in it.

How to assign the address to Pointer?

Let, say we have an integer variable xyz and have value 7 in it.
int xyz = 7;
We can assign the address of this integer variable to the pointer we have declared first by using address operator (&). Just like that
numberPtr = &xyz;
Now the pointer numberPtr have the address of variable xyz in it or pointing to variable xyz.

You can understand by this
pointer pointing to the variable xyz
The pointer numberPtr is now pointing to the variable xyz.


If we print the value of pointer numberPtr just as we print values of variables then this would not print the exact result you expect because the numberPtr does not have the value you want to print. It has the address of the variable xyz.

For example, if you print like
printf("Value of numberPtr: %d ",numberPtr);
then this would not print the value 7 because numberPtr has the address of xyz.

In my computer, it is printing 6356744.

If you want to print the exact value of the variable to which the pointer is pointing then you have to dereference it by using the dereferencing operator (*) in printing. Just like that
printf("Value of numberPtr: %d ",*numberPtr);

This will print the exact value of variable xyz which is 7.

If the pointer is not initialized correctly with some address then the dereferencing will lead to error.


  1. Replies
    1. I am glad that I saw this post. It is informative blog for us and we need this type of blog thanks for share this blog, Keep posting such instructional blogs and I am looking forward for your future posts. Python Projects for Students Data analytics is the study of dissecting crude data so as to make decisions about that data. Data analytics advances and procedures are generally utilized in business ventures to empower associations to settle on progressively Python Training in Chennai educated business choices. In the present worldwide commercial center, it isn't sufficient to assemble data and do the math; you should realize how to apply that data to genuine situations such that will affect conduct. In the program you will initially gain proficiency with the specialized skills, including R and Python dialects most usually utilized in data analytics programming and usage; Python Training in Chennai at that point center around the commonsense application, in view of genuine business issues in a scope of industry segments, for example, wellbeing, promoting and account. Project Center in Chennai


  2. 2 of 65

    Tuhin Pabna
    Nov 28, 2019, 9:29 AM
    to noyon0461

    2 Attachments

    keep up the good work. this is an Assam post. this to helpful, i have reading here all post. i am impressed. thank you. this is our digital marketing training center. This is an online certificate course
    digital marketing training in bangalore / https://www.excelr.com/digital-marketing-training-in-bangalore

  3. Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. I wanted to thank you for this websites! Thanks for sharing. Great websites!
    Data Science Certification in Bangalore

  4. I feel very grateful that i read this.It is very helpful and very informative and i really learned a lot from it.
    learn360digitmg artificial intelligence course

  5. I am impressed by the information that you have on this blog. It shows how well you understand this subject.
    Data Science Institute in Bangalore

  6. I'm happy to see the considerable subtle element here!.
    360digitmg ai online course

  7. Nice knowledge gaining article. This post is really the best on this valuable topic.
    360digitmg business analytics online course

  8. Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Keep posting. Thanks for sharing.
    360digiTMG data science training in guduvanchery

  9. There are many custom finance assignment writing services and Finance Coursework Writing Services to choose from for those stuck with their finance case study writing services and finance research paper help services.

  10. Glad to chat your blog, I seem to be forward to more reliable articles and I think we all wish to thank so many good articles, blog to share with us.
    360digitmg data science courses

  11. Nice post found to be very impressive to come across such an awesome content along with a unique content. Lots of appreciation to the blogger who took an initiative to write this particular blog. Thanks for sharing and keep posting such an informative content.

    360DigiTMG Cyber Security Course

  12. Great post found to be very impressive while going through the blog. I really enthusiased while reading and enjoyed every bit of your content. Certainly, since this blog is being more informative it ia an added advantage for the users who are going through this blog. Once again nice blog keep it up.

    360DigiTMG IoT Course

  13. Attend The Artificial Intelligence course From ExcelR. Practical Artificial Intelligence course Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Artificial Intelligence course.
    Artificial Intelligence Course

  14. Your content is very unique and understandable useful for the readers keep update more article like this.
    business analytics course in aurangabad

  15. Thanks for Sharing this Valuable Information with us: this is very useful for me. Keep it Up.
    best data science course online

  16. The blog is amazing, and the topic is fantastic. However, a little more study may have bolstered it even further. Consider hiring my assignment aid, a well-known help with my assignment platform that combines the finest of New Zealand Referencing Generator with expertise and experience.

  17. Extraordinary blog went amazed with the content that they have developed in a very descriptive manner. This type of content surely ensures the participants to explore themselves. Hope you deliver the same near the future as well. Gratitude to the blogger for the efforts.

    Data Science Training

  18. Stupendous blog huge applause to the blogger and hoping you to come up with such an extraordinary content in future. Surely, this post will inspire many aspirants who are very keen in gaining the knowledge. Expecting many more contents with lot more curiosity further.

    Data Science Certification in Bhilai

  19. The content on this blog has really impressed me. It shows how well you understand this topic. This is a very beneficial thing for students because such students are unable to handle their sociology essay help through their own efforts. Thank You!!