Why is this invalid?

This is a discussion on Why is this invalid? within the C Programming forums, part of the General Programming Boards category; 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 ...

  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-24-2006, 12:40 AM
  3. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 09:39 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07: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

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