Unary + operator

This is a discussion on Unary + operator within the C Programming forums, part of the General Programming Boards category; Hi All, Why do we need a unary + operator? Almost all the languages from C, C++, Java support it. ...

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    2

    Unary + operator

    Hi All,
    Why do we need a unary + operator? Almost all the languages from C, C++, Java support it. What is the use of it?

    Regards,
    Karan S

  2. #2
    Im back! shaik786's Avatar
    Join Date
    Jun 2002
    Location
    Bangalore, India
    Posts
    345

  3. #3
    Registered User
    Join Date
    Jul 2002
    Posts
    2
    I want to know the use of the unary + operator. See there is a unary - operator which has a use i.e., when applied to a number variable it actually multiplies it by -1 and produces the result.

    But applying a unary + before a variable does nothing. The value remains the same. So why do we need a unary + operator?

  4. #4
    Registered User pinko_liberal's Avatar
    Join Date
    Oct 2001
    Posts
    284
    I dont think it has any practical use either .

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >What is the use of it?
    Symmetry with unary -.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. unary operator overloading and classes
    By coletek in forum C++ Programming
    Replies: 9
    Last Post: 01-10-2009, 02:14 AM
  2. Smart pointer class
    By Elysia in forum C++ Programming
    Replies: 63
    Last Post: 11-03-2007, 08:05 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  4. evaluating unary negation operator in an infix expression??
    By YevGenius in forum C++ Programming
    Replies: 7
    Last Post: 05-12-2004, 02:18 PM
  5. operator overloading and dynamic memory program
    By jlmac2001 in forum C++ Programming
    Replies: 3
    Last Post: 04-07-2003, 12:51 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21