Thread: what is int()?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Madly in anger with you
    Join Date
    Nov 2005
    Posts
    211

    what is int()?

    hey all, just reading some code I got off of planet-source-code, and ran into this statement:

    Code:
    b = int(a);  // store the ASCII value of a into b as an int value
    what is int(a)? is it a malformed cast or is it a function? the writer says he compiled it in Borland C++, and I know Borland Delphi has cast-like functions like StrToInt and IntToStr, hence the reason why I am asking if it is a function (I've never seen a cast written like that). I went looking through the entire source for it, and if it is a function, or even a macro-function, its not declared in any of his code.

    however I would think of it as a malformed cast, better written as:

    Code:
    b = (int)a;
    b is a char, and a is a char by the way. would the above cast not assign the ASCII value of a to b?

    as always, your help is greatly appreciated.


    thank you in advance.
    Last edited by Bleech; 11-08-2006 at 02:25 AM.

    Intel Core 2 Quad Q6600 @ 2.40 GHz
    3072 MB PC2-5300 DDR2
    2 x 320 GB SATA (640 GB)
    NVIDIA GeForce 8400GS 256 MB PCI-E

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. memory leak
    By aruna1 in forum C++ Programming
    Replies: 3
    Last Post: 08-17-2008, 10:28 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. getting a headache
    By sreetvert83 in forum C++ Programming
    Replies: 41
    Last Post: 09-30-2005, 05:20 AM
  4. Quack! It doesn't work! >.<
    By *Michelle* in forum C++ Programming
    Replies: 8
    Last Post: 03-02-2003, 12:26 AM
  5. easy if you know how to use functions...
    By Unregistered in forum C Programming
    Replies: 7
    Last Post: 01-31-2002, 07:34 AM