Too Many Initializers With Visual Studio?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • maria

    #1

    Too Many Initializers With Visual Studio?

    I have an array,

    string data[248][5],

    which produces the error "Too many initializers".
    Each one of the 248 rows has 5 items with
    a maximum total length of 173 characters.
    I am using Visual Studio 6.0. Should I allocate memory
    for this array to avoid the error? If the answer is "Yes", would you
    please be kind enough to tell me how?
    Thank you very much.

    maria

    XP, 3.4GB CPU, 2GB RAM
  • suresh shenoy

    #2
    Re: Too Many Initializers With Visual Studio?

    On Mar 27, 3:38 pm, maria <maria@maria_de _napoli.comwrot e:
    I have an array,
    >
    string data[248][5],
    >
    which produces the error "Too many initializers".
    Each one of the 248 rows has 5 items with
    a maximum total length of 173 characters.
    I am using Visual Studio 6.0. Should I allocate memory
    for this array to avoid the error? If the answer is "Yes", would you
    please be kind enough to tell me how?
    Thank you very much.
    >
    maria
    >
    XP, 3.4GB CPU, 2GB RAM

    You are declaring 248 * 5 strings. Is this what you want? I believe
    you may have crossed the initialization limit.

    Suresh M. Shenoy

    Comment

    • Victor Bazarov

      #3
      Re: Too Many Initializers With Visual Studio?

      suresh shenoy wrote:
      On Mar 27, 3:38 pm, maria <maria@maria_de _napoli.comwrot e:
      >I have an array,
      >>
      >string data[248][5],
      >>
      >which produces the error "Too many initializers".
      >Each one of the 248 rows has 5 items with
      >a maximum total length of 173 characters.
      >I am using Visual Studio 6.0. Should I allocate memory
      >for this array to avoid the error? If the answer is "Yes", would you
      >please be kind enough to tell me how?
      >Thank you very much.
      >>
      >maria
      >>
      >XP, 3.4GB CPU, 2GB RAM
      >
      >
      You are declaring 248 * 5 strings. Is this what you want? I believe
      you may have crossed the initialization limit.
      1240 strings? Come on! What "initializa tion limit"? Of course, we
      haven't see the actual _initialisation _ to make any determination.. .

      To 'maria':

      Arrays do not "produce the error", your code does. Post your code.

      V
      --
      Please remove capital 'A's when replying by e-mail
      I do not respond to top-posted replies, please don't ask


      Comment

      • peter koch

        #4
        Re: Too Many Initializers With Visual Studio?

        On 27 Mar., 20:38, maria <maria@maria_de _napoli.comwrot e:
        I have an array,
        >
        string data[248][5],
        >
        which produces the error "Too many initializers".
        Each one of the 248 rows has 5 items with
        a maximum total length of 173 characters.
        I am using Visual Studio 6.0. Should I allocate memory
        for this array to avoid the error? If the answer is "Yes", would you
        please be kind enough to tell me how?
        Thank you very much.
        >
        I am quite sure that the number of elements is not a problem in the
        way you seem to imply. The problem likely is that you have to many
        elements in your array. I guess

        int v[2] = { 0, 1, 2 };

        gives you the same errormessage.

        /Peter

        Comment

        • maria

          #5
          Re: Too Many Initializers With Visual Studio?

          On Thu, 27 Mar 2008 12:39:06 -0700 (PDT), peter koch
          <peter.koch.lar sen@gmail.comwr ote:
          >On 27 Mar., 20:38, maria <maria@maria_de _napoli.comwrot e:
          >I have an array,
          >>
          >string data[248][5],
          >>
          >which produces the error "Too many initializers".
          >Each one of the 248 rows has 5 items with
          >a maximum total length of 173 characters.
          >I am using Visual Studio 6.0. Should I allocate memory
          >for this array to avoid the error? If the answer is "Yes", would you
          >please be kind enough to tell me how?
          >Thank you very much.
          >>
          >
          >I am quite sure that the number of elements is not a problem in the
          >way you seem to imply. The problem likely is that you have to many
          >elements in your array. I guess
          >
          int v[2] = { 0, 1, 2 };
          >
          >gives you the same errormessage.
          >
          >/Peter
          Thank you all very much for your help.
          You were right.
          It was some invisible character that made
          Visual Studio count the array elements wrong.

          maria

          Comment

          Working...