Thread: Converting Types

  1. #1
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542

    Converting Types

    Can some1 please point me to a website that teaches converting? Example: from int to char, etc..
    what does signature stand for?

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Code:
    int IntValue = 64;
    char CharValue = (char)IntValue;
    
    char* CharArrayValue = "123";
    int IntValue2 = atoi(CharArrayValue);
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    In general there are four solution to type conversion in C++.

    static_cast
    reinterpret_cast
    const_cast
    dynamic_cast

    Kuphryn

  4. #4
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    arent we forgetting conversion operators and non-explicit single argument constructors. Also constructors with default params.

    There is much more to this subject than first meets the eye.

    You will learn a lot here
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  5. #5
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    I never did know the difference between the 4 types. In fact, I never knew there were 4 types
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Converting Between Data Types
    By emodius in forum C Programming
    Replies: 3
    Last Post: 04-20-2009, 12:05 PM
  2. Converting types while keeping same size.
    By sbho in forum C Programming
    Replies: 3
    Last Post: 06-08-2007, 04:41 AM
  3. The Interactive Animation - my first released C program
    By ulillillia in forum A Brief History of Cprogramming.com
    Replies: 48
    Last Post: 05-10-2007, 02:25 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. converting data types
    By jaXx in forum C Programming
    Replies: 10
    Last Post: 01-02-2005, 02:50 PM