×

# assignment operation on Pointers

 0 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 6●1●1●2 accept rate: 0%

 1 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 1★mayagr 42●1●1●3 accept rate: 100%
 0 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 0★arun92 0●1●1●1 accept rate: 0%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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:

×1,477
×62

question asked: 20 Oct '12, 23:55

question was seen: 1,006 times

last updated: 21 Oct '12, 12:08