Hello, MCENANEY!

On Mon, 25 May 1998, MCENANEY WILLIAM J wrote:

>Glynn has asked me how I would compare two pointers if I could replace
>"strcmp() == 0" with a relational equal sign.

>Suppose a pointer is only
>an address.

'pointer' is the same as 'address'.

>Then could I write, "if (&s1 = &s2) . . ."? Or would that
>compare the address of s1's first character to the address of s2's
>first character?

Man, you definetely need to read books. What do you want to compare ?
Strings or pointers or pointers to pointers ?

(s1==s2) ==> !strcmp(s1,s2)       [ this is one string ]
(&s1==&s2) ==> (s1==s2)           [ this is the same pointers ]

s1 - is a pointer to string, or an address of string in memory. ( the same s2
is )

>Maybe I could create a standard function named "pointer_of."  For C
>programmers, that may be a little wordy.  But with it, I could say:
>
>       if (pointer_of(s1) = pointer_of(s2))
                           ^^ "==" should be here.
>           puts ("The addresses are the same.");

But what the sense of this function ???

Bye.
--
Reporter (to Mahatma Gandhi): Mr Gandhi, what do you think of Western
        Civilization?
Gandhi: I think it would be a good idea.

--
    With best of best regards, Pawel S. Veselov (aka Black Angel)
                   Internet e-mail : [EMAIL PROTECTED]
    Web page : http://www.math.spbu.ru/~vps/ | ICQ UIN : 5252265

Reply via email to