Thread: how to check if two link list nodes are same .. ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    If pt1 and pt2 both point to the same instance you can test them for equality. You're misreading what that exceprt says.

    When they said "comparison" they were referring to something like if(pt1 < pt2) which is actually useful in an array, but not really anywhere else. "Comparison" is not the same as "equality or inequality".

    Here's something from a little newer reference.

    From ISO C99:
    6.5.9 Equality operators
    Syntax
    1 equality-expression:
    relational-expression
    equality-expression == relational-expression
    equality-expression != relational-expression
    Constraints
    2 One of the following shall hold:
    — both operands have arithmetic type;
    — both operands are pointers to qualified or unqualified versions of compatible types;
    — one operand is a pointer to an object or incomplete type and the other is a pointer to a
    qualified or unqualified version of void; or
    — one operand is a pointer and the other is a null pointer constant.
    Last edited by itsme86; 05-23-2006 at 02:23 PM.
    If you understand what you're doing, you're not learning anything.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. swapping nodes in double linked list
    By a0161 in forum C Programming
    Replies: 15
    Last Post: 10-30-2008, 06:12 PM
  2. deleting a node in linked list
    By BoneXXX in forum C Programming
    Replies: 18
    Last Post: 12-17-2007, 12:30 PM
  3. Adding nodes to a linked list
    By bluescreen in forum C Programming
    Replies: 4
    Last Post: 11-09-2006, 01:59 AM
  4. stack error occured in link list
    By mycount in forum C Programming
    Replies: 5
    Last Post: 07-11-2006, 09:03 PM
  5. singly linked list
    By clarinetster in forum C Programming
    Replies: 2
    Last Post: 08-26-2001, 10:21 PM