Hello Anuradha,
I was thinking about your query. I think you were asked to interchange between 
two memory locations without using any third pointer.
Let there be two pointers, 
int *x,*y;
        Considering variable 'x' represents some memory location which contains 
the address 0x800 which is another memory location containing some value say 5. 
Similarly variable 'y' represents some memory location which contains the 
address 0x200 which is another memory location containing some value say 6.
        Now if you are to interchange between these two pointers without using 
a third memory location/pointer/variable lets do it like this
*x=5;
*y=6;
*x=*x+*y;  |
*y=*x-*y;   |
*x=*x-*y;   |
So that 0x800 now contains 6 and 0x200 now contains 5;
Is it your query ??
Regards,
Debasish
Ray Devore <[EMAIL PROTECTED]> wrote:                                  --- 
uugnaa altaa <[EMAIL PROTECTED]> wrote:
 > I guess, it is more likely the question about
 > pointer to pointer. 
 > 
 > useing pointer to pointer, you can store address of
 > the pointer, that is it.
 > 
 > int **src, *dst;
 > dst = 200
 > *src = dst;
 > 
 > something like this ..,
 > 
 > anu radha <[EMAIL PROTECTED]> wrote:            
 >                      Hello all,
 >     
 >                  2 days back i attended an interview
 > where i was asked a question.The question is "how to
 > give one address to other address without the using
 > any variables".(i.e) suppose one location is 200 and
 > other is 800 how to make 800=200(making address 800
 > as 200) directly....(using only addresses).
 >     
 >    i googled it but did'nt find an  appropriate
 > answer...
 >     
 >    please help....
 >     
 >    thanx in advance..
 >  
 The statement 
  dst = 200;
 will give an error.  You cannot assign an address to a
 pointer.
 
 Ray
 
 __________________________________________________________
 Need Mail bonding?
 Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
 http://answers.yahoo.com/dir/?link=list&sid=396546091
 
     
                       


Karmennevaya Dhikaraste, Maaphaaleshu Kadaachanah
                                
---------------------------------
 Here’s a new way to find what you're looking for - Yahoo! Answers 

[Non-text portions of this message have been removed]

Reply via email to