C/Confuse In Pointer...@
Expert: Zlatko - 5/15/2010
QuestionHello Sir/Madem...
My Name Is Vandan & I Am In T.Y B.C.A. I Need Help In Pointer In C Prog.
QUESTION :- HOW TO MULTIPLY TWO INTEGER VALUE USING POINTER IN C?
AnswerHello Vandan
Here is some sample code with comments to show you how pointers can be used.
/* declare 2 integers and a result */
int a;
int b;
int result;
/* declare 2 pointers to integers
int* pa;
int* pb;
/* assign pointers */
/* pa gets address of a */
pa = &a;
/* pb gets address of b */
pb = &b;
/* assign values to the integers */
a = 2;
b = 3;
/* multiply the integers using the pointers */
/* result gets what is pointed at by pa times what is pointed at by pb */
result = *pa * *pb
When you see &a, read it as "address of a".
When you see *pa, read it as "pointed at by pa"
If anything is not clear, please ask as specific question about what you don't understand.
Best regards
Zlatko