array assignment question

This is a discussion on array assignment question within the C Programming forums, part of the General Programming Boards category; hi! i have the following sample code: Code: unsigned long *addr = 0xcde8f1a1; void* sys_table[] = addr; /* compiler error: ...

  1. #1
    template<typename T> threahdead's Avatar
    Join Date
    Sep 2002
    Posts
    214

    array assignment question

    hi!

    i have the following sample code:
    Code:
    unsigned long *addr = 0xcde8f1a1;
    void* sys_table[] = addr; /* compiler error: invalid initializer */
    when trying to compile this, i get an error that the second line
    initializes the variable in the wrong way.

    whats wrong?

    thanks alot

  2. #2
    template<typename T> threahdead's Avatar
    Join Date
    Sep 2002
    Posts
    214
    thanks.

    Code:
    void *sys_table[] = (void **)addr;
    works fine aswell for me.

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    And the purpose of having a single element array is...?
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dynamic Mutli dimensional Array question.
    By fatdunky in forum C Programming
    Replies: 6
    Last Post: 02-22-2006, 07:07 PM
  2. Array of Structs question
    By WaterNut in forum C++ Programming
    Replies: 10
    Last Post: 07-02-2004, 03:58 PM
  3. Merge sort please
    By vasanth in forum C Programming
    Replies: 2
    Last Post: 11-09-2003, 12:09 PM
  4. Struct *** initialization
    By Saravanan in forum C Programming
    Replies: 20
    Last Post: 10-09-2003, 01:04 PM
  5. Help with an Array
    By omalleys in forum C Programming
    Replies: 1
    Last Post: 07-01-2002, 09:31 AM

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