Thread: Why is this invalid?

  1. #1
    ---
    Join Date
    May 2004
    Posts
    1,379

    Why is this invalid?

    Code:
    int array[5] = {1,1,1,1,1};
    int num = 1;
    int *ptr_to_int = #
    
    
    if(array[*ptr_to_int] == 1)
        ...
    its not a big deal, ive already worked around this problem but i was just curious why i cant put a pointer to an int as the array subscript

  2. #2
    Registered User Scribbler's Avatar
    Join Date
    Sep 2004
    Location
    Aurora CO
    Posts
    266
    It is valid. What exactly is the error or warning you're getting?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  2. Assignment output help
    By Taka in forum C Programming
    Replies: 13
    Last Post: 09-23-2006, 11:40 PM
  3. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Flood of errors when include .h
    By erik2004 in forum C++ Programming
    Replies: 14
    Last Post: 12-07-2002, 07:37 AM