Newbie Question

This is a discussion on Newbie Question within the C++ Programming forums, part of the General Programming Boards category; The problem with it is that it has no application in programming. You will need to gather input from a ...

  1. #16
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    The problem with it is that it has no application in programming. You will need to gather input from a user and define space for it on the heap, than return a pointer to the array. MSVC++ can kiss my ass. So use the new operator from the caller or else pass the array as an argument. End of story. On the other hand, if you use the C++ string than you can return it from the caller and a copy will be made.

  2. #17
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,786
    Originally posted by Troll_King
    The problem with it is that it has no application in programming. You will need to gather input from a user and define space for it on the heap, than return a pointer to the array. MSVC++ can kiss my ass. So use the new operator from the caller or else pass the array as an argument. End of story. On the other hand, if you use the C++ string than you can return it from the caller and a copy will be made.
    But the purpose of his program did not call for any user input.....he was simply passing a literal string to cout......that's all......

    I could have taken the string out of my prog as that was not needed, but as he had shown an interest in using string objects in his inital attempt, I threw one in for good measure....

    Your right that the program is very limited, but the his idea was limited to start with so I see no problem....

  3. #18
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    I believe that the new operator supports initializaton.

    First off, the original poster is a mental retard who deserves a walloping. Second, string literals are special cases. The context is misguiding to a newbie I didn't cause trouble here, my name is not Enmerdemonkey.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stupid Newbie question
    By TimL in forum C++ Programming
    Replies: 4
    Last Post: 07-22-2008, 04:43 AM
  2. C prog newbie question
    By Draginzuzu in forum C Programming
    Replies: 1
    Last Post: 02-03-2003, 05:45 PM
  3. a stupid question from a newbie
    By newcomer in forum C++ Programming
    Replies: 4
    Last Post: 01-11-2003, 03:38 PM
  4. confusion with integers (newbie question)
    By imortal in forum C Programming
    Replies: 7
    Last Post: 12-06-2002, 03:09 PM
  5. newbie class templates question
    By daysleeper in forum C++ Programming
    Replies: 2
    Last Post: 09-18-2001, 09:50 AM

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