Difference between two styles of declaration

This is a discussion on Difference between two styles of declaration within the Game Programming forums, part of the General Programming Boards category; With c++ you can use strings.h (or sting.h on some people's computers) to allow you to create string variables with ...

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

    Difference between two styles of declaration

    With c++ you can use strings.h (or sting.h on some people's computers) to allow you to create string variables with much more ease than a char array of 255 chars.

    When including strings.h you can...

    string mystring;

    very simply, and testing is simply If(mystring=="mystring")

    As opposed to

    char mystring[255];

    where testing is done by: If(strcmp(mystring,"mystring")==0)


    Are there any downs to using the first way? Isn't it more logical? =)
    chaser

  2. #2
    Registered User The Dog's Avatar
    Join Date
    May 2002
    Location
    Cape Town
    Posts
    788
    use the first method

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    194
    Yes the string class is more logical.
    The other way you mention is how programmers created strings before C++. There were no classes to hide all the data and methods in.
    I use the string class most of the time.

  4. #4
    Registered User
    Join Date
    Jul 2002
    Posts
    10

    It's just not blue

    When you type it, it's not a ide keyword, or whatever. So it's black and not blue when typed, correct? Shouldn't matter?
    chaser

  5. #5
    Registered User Coder's Avatar
    Join Date
    Aug 2001
    Location
    Cairo, Egypt
    Posts
    128
    Chaser, I've noticed that you're posting about non game-related issues lately. These posts should go to the C/C++ board.

    Thanks
    Muhammad Haggag

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 11:17 AM
  2. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 03:49 PM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 08:13 PM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM

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