Results 1 to 10 of 14

Thread: [C] The lousy random question thread

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    next 'problem':

    i've got a struct including an array
    this array should be variable in its length , but <= MAX_LENGTH

    PHP Code:
    #define MAX_LENGTH 256

    struct myStruct
    {
        
    int array[MAX_LENGTH];
    }; 
    infact this struct is now filled with 256 unused integers
    how do i get anything similar to this without having a big empty array?

    EDIT:
    and i dont want to allocate new memory for every single input
    so neither 'int* array;' nor 'int array[];' will work without that and without using static construction like: 'struct myStruct s = { 1 , 2 , 3 };'
    Last edited by serthy; 15th August 2013 at 20:27.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •