I worte my answers after the arrowes ==> . . .

--- In [email protected], Jim Dougherty <[EMAIL PROTECTED]> wrote:
>
> No, a=b is NOT the same as *a=*b.
> 
> Here are some examples that may help:
> 
> int   x;    // ==>that's okay
> int   y;    // ==>that's okay
> 

> int  *a;    // ==>that's also okay (defining pointers)
> int  *b;    // ==>that's also okay (defining pointers)

> 
> x = 123;    // ==>that's okay too
> y = 456;    // ==>that's okay too

> 
> a = NULL;   // "A points at 0."
              // ==>that's like a = '\0' it's fine by me.
              //  "*A is whatever int lies at 0."
              //==>did you mean that - 
              //==>*A points to a cell number(i.e. 1024) ?
> 
> a = x;      // "illegal statement"
              //==> why it's illegal?
> 
> a = &x;     // "A points at X.  *A is 123 which is the value of X."
              //==>*A is what is INSIDE the cell(i.e. 123)
              //==>&A is the address of the cell(i.e. 1024)
> 
> b = &y;     // "B points at Y. *B is 456 which is the value of Y."
              //==>that the same as *B=1024(as cell no.) ?
> 
> a = b;      //==> A now points at B which point at Y  
              //"*A is now 456."
              //==>and *A still points to Y ?
> 
> *a = 789;   //that's okay by me

====== > >  many thanks !!
> 
> 
> 
> [email protected] wrote:
> > Hello again.
> > and thanks for all the answers !!
> > 
> > continuing from my question-
> > is a=b the same like *a=*b ??
> > *a == &a ? and *b==&b or I got it all mixed up?
> > if a and b were initialized in the begining with NULL(\0),
> > what was the difference ?
> > 
> > --- In [ mailto:c-prog%40yahoogroups.com [EMAIL PROTECTED], 
Jim Dougherty
> > <j_dougherty@> wrote:
> >>
> >>
> >> [ mailto:c-prog%40yahoogroups.com [EMAIL PROTECTED] wrote:
> >>> [ mailto:c-prog%40yahoogroups.com ][ mailto:c-prog%
40yahoogroups.com
> > [EMAIL PROTECTED] wrote:
> >>>> defined -
> >>>> int *a,*b;
> >>>>
> >>>> what's the difference between:
> >>>>
> >>>> 1. *a=b;
> >>> Here, the location pointed to by A (which is an INT) 
> >>> is set to the contents of pointer B (which is a pointer to an 
> > INT).
> >>> Note: the compiler should give you an error/warning about this.
> >>>
> >>>> 2. a=b;
> >>> Here, the pointer A (which is a pointer to an INT) 
> >>> is set to the contents of the pointer B (which is a pointer to 
an 
> > INT).
> >>
> >> Maybe what you intended but did not specify was:
> >>
> >> *a = *b;
> >>
> >> Here, the location pointed to by A (which is an INT)
> >> is set to the contents of the location pointed to by B (which is 
an 
> > INT).
> > 
> > 
> > 
> > 
> >  
> > 
> >
>


Reply via email to