data types

This is a discussion on data types within the C++ Programming forums, part of the General Programming Boards category; im trying to store someones initials in a variable, but im not sure how to do it, because I can't ...

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    2

    data types

    im trying to store someones initials in a variable, but im not sure how to do it, because I can't figure out which data type to use.

    for example

    <datatype> foo = "T.A"

    or something..

  2. #2
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    You can use a character array (char[]), but I would recommend using a std::string from <string>. It much easier to use, and will take care of its own memory management.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  3. #3
    Registered User
    Join Date
    Jun 2003
    Posts
    2
    thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extending basic data types.
    By nempo in forum C++ Programming
    Replies: 23
    Last Post: 09-25-2007, 04:28 PM
  2. Replies: 4
    Last Post: 06-14-2005, 06:45 AM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 04:00 PM
  4. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 07:51 PM
  5. Using enumerated data types
    By SXO in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2001, 07:26 PM

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