i wasn't able to think of other method but why are you using cout<<(void *)p; for dereferencing............. cout<<*x is working to find to the value at memory ocation x.
On Sat, Jun 4, 2011 at 3:09 AM, Navneet Gupta <[email protected]> wrote: > Can't think of any trivial/straight forward way of doing that other > than dereferencing pointer. > > On Sat, Jun 4, 2011 at 3:34 PM, D.N.Vishwakarma@IITR <[email protected]> > wrote: > > I'm saying that int *x=new int(3); is a statement . > > I want to find value at location allocated by new which is 3 in this case > by > > indirect way ... without use of (void*)x. > > > > On Sat, Jun 4, 2011 at 3:23 PM, Navneet <[email protected]> wrote: > >> > >> Sorry but the context is not very clear. What exactly are you trying > >> to do? > >> Looks like you want to allocate space for an integer value and assign > >> the value p to it. > >> So, you need to refer it with some pointer (in this case x). > >> > >> > >> On Jun 4, 2:24 pm, "D.N.Vishwakarma@IITR " <[email protected]> wrote: > >> > say memory location is 0x33f070 of int *x=new int(p); > >> > p is some value at that location. we have to find p at that location > >> > using > >> > some indirect way... > >> > without using cout<<(void*x); Is there any other way to find p? > >> > > >> > -- > >> > **With Regards > >> > Deoki Nandan Vishwakarma > >> > IITR MCA > >> > Mathematics Department* > >> > * > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "Algorithm Geeks" group. > >> To post to this group, send email to [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]. > >> For more options, visit this group at > >> http://groups.google.com/group/algogeeks?hl=en. > >> > > > > > > > > -- > > With Regards > > Deoki Nandan Vishwakarma > > IITR MCA > > Mathematics Department > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Algorithm Geeks" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group at > > http://groups.google.com/group/algogeeks?hl=en. > > > > > > -- > --Navneet > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
