Reg array size

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shariquehabib
    New Member
    • Oct 2006
    • 22

    Reg array size

    Hi all,

    I am defining array of structure like that : STRUCT_NAME array[1024].
    I am fetching some records from EMP table and copying into that array one by one using while loop.

    But it will work only 1024 records if records will be greater than 1024 then it will not work.
    If I increase the size as 1030 then it will work for 1030 records.

    But If I increase the size as 1031 or 1100 then it will show “application error”.

    Could you please let me know that how can I resolve this prob???
    How can I define this array.??

    Thnks in advance,
    Sharique
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    Originally posted by shariquehabib
    Hi all,

    I am defining array of structure like that : STRUCT_NAME array[1024].
    I am fetching some records from EMP table and copying into that array one by one using while loop.

    But it will work only 1024 records if records will be greater than 1024 then it will not work.
    If I increase the size as 1030 then it will work for 1030 records.

    But If I increase the size as 1031 or 1100 then it will show “application error”.

    Could you please let me know that how can I resolve this prob???
    How can I define this array.??

    Thnks in advance,
    Sharique
    Hi,
    It may crash if it is not able to find the required size for the array in the stack.
    Try to allocate the memory for the structure dynamically.
    [code=c]
    STRUCT_NAME *array=(STRUCT_ NAME*)malloc(si zeof(STRUCT_NAM E)*1024);
    [/code]

    Raghuram

    Comment

    Working...