You are not logged in. Please login at to post your questions!


assignment operation on Pointers

Am a absolute beginner in C programming. My doubt is int a=10; int *b;

what is the difference between

b=a; and b=&a; ?

asked 20 Oct '12, 23:55

prathaprajiv's gravatar image

accept rate: 0%

b=a ... will result in b pointing to the memory location of 10 ( which is the value of a ), value of b will have some undefined value.
b=&a .... will result in b pointing to the location of a . hence
b will have the value 10 .


answered 21 Oct '12, 12:08

mayagr's gravatar image

accept rate: 100%

b=a is a assignment statement which assigns the value of a to b. In the other case b=&a is a pointer notation a=10 is stored in a particular location and the address of the location is assigned to b.In other words b points the location of a.


answered 21 Oct '12, 00:55

arun92's gravatar image

accept rate: 0%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 20 Oct '12, 23:55

question was seen: 1,006 times

last updated: 21 Oct '12, 12:08