Thread: what is this suppose to be?

  1. #1
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007

    what is this suppose to be?

    BYTE (*main_data)[1000];
    I thought that it might be an array of pointers, but then I saw this line
    main_data = malloc(1000);
    But this line contradicts that theory. It would have to allocate 4 kb (not 1) if that was the case.

    I never thought I'd be asking a question like this, but, what does this initilizer really do?
    I just want to use my computer in a productive manner, not learn how to use it. Elysia
    A year spent in artificial intelligence is enough to make one believe in God. Alan Jay Perlis

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    It's a pointer to an array. You can make it point to an array:
    BYTE ar[1000];
    BYTE (*main_data)[1000] = &ar;
    But I'm not sure if this works under VC++, because traditionally, due to compatibility with stupid code, VC++ interprets &ar as &ar[0] (or just ar).
    All the buzzt!

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 12-03-2008, 03:10 AM
  2. is this how a function is suppose to work?
    By ktran03 in forum C Programming
    Replies: 14
    Last Post: 11-06-2008, 03:39 AM
  3. Replies: 6
    Last Post: 07-14-2008, 10:51 AM
  4. Program ideas...
    By code987 in forum C++ Programming
    Replies: 3
    Last Post: 11-18-2002, 11:41 PM
  5. How am i suppose to do this???
    By darketernal in forum C++ Programming
    Replies: 10
    Last Post: 10-06-2001, 11:48 AM