Thread: const

  1. #1
    Registered User
    Join Date
    May 2015
    Posts
    10

    const

    i have a function using a two dimention array from the type of
    const unsigned char* const*
    how do i create such a type and intalize it? if i use those two const i can't intalize the array cause it is const and if i omit one of them the compiler say it isn't the right type.

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    You have to initialize it at the point where you create your variable:

    Code:
    const char* bar[] = {"Hello","World"};
    const char* const* foo = bar;
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 04-20-2011, 01:19 PM
  2. Replies: 3
    Last Post: 11-15-2009, 04:57 AM
  3. Replies: 1
    Last Post: 04-03-2009, 08:52 AM
  4. Replies: 7
    Last Post: 04-28-2008, 09:20 AM
  5. Mutable members in const member functions still const
    By ripper079 in forum C++ Programming
    Replies: 3
    Last Post: 10-23-2002, 08:56 AM