Friday, April 6, 2012

how to add two pointers

hye, after a long time im writing a post.
todays topic is how to add two pointers.
its very simple and easy.
my college C teacher told me that you cannot add two pointers but after a while i got an idea how to do it.
before reading further i expect that you know type conversion.
 #include<conio.h>
 #include<stdio.h>
 int main(int argc, char *argv[])
 {
 int *a,*b;
 float c =(float)( (unsigned int)a + (unsigned int)b );/*address are unsigned integers( location are positive )*/
        clrscr();
 printf("%u + %u = %f",&a,&b,c);
 getchar();
 return 0;
 }
now if your teacher says that you cannot add two pointer,let him see the above code.:)
thank you bye.see you soon.

Labels: , , , , , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

Links to this post:

Create a Link

<< Home