Char Array Question.

This is a discussion on Char Array Question. within the C++ Programming forums, part of the General Programming Boards category; Code: char *nchar = "Testing 1, 2, 3\n"; Does this create a pointer to a char array on the heap ...

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

    Char Array Question.

    Code:
    char *nchar = "Testing 1, 2, 3\n";
    Does this create a pointer to a char array on the heap that stores "Testing 1, 2, 3\n" ?

  2. #2
    Registered User Dr. Bebop's Avatar
    Join Date
    Sep 2002
    Posts
    96
    Usually the heap means a chunk of memory that you can use by allocating parts of it with new. String literals don't have to be on the heap and they're usually put in some kind of read only memory. Where it goes depends on the compiler that you use.
    Processing error: Stupidity detected.
    ------------------------------
    Dr. Bebop
    Windows XP Professional Ed.
    Microsoft Visual Studio 6

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File input question
    By Beast() in forum C Programming
    Replies: 16
    Last Post: 07-09-2004, 03:23 PM
  2. comparing fields in a text file
    By darfader in forum C Programming
    Replies: 9
    Last Post: 08-22-2003, 08:21 AM
  3. Replies: 5
    Last Post: 05-30-2003, 12:46 AM
  4. help with array of char and char **
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 04-20-2002, 02:23 PM
  5. Strings are V important...
    By NANO in forum C++ Programming
    Replies: 15
    Last Post: 04-14-2002, 11:57 AM

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