Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. What is the syntax of a static int array to array structure?

What is the syntax of a static int array to array structure?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestiondata-structures
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hakan Bulut
    wrote on last edited by
    #1

    static int* arCombs[6][11] = { // Syntax error. arCombs[0] = {i1,i2,i3,i4,i5,i6}; arCombs[1] = {i7,i8,i9,i10,i1,i2}; arCombs[2] = {i8,i9,i10,i1,i2,i3}; arCombs[3] = {i9,i10,i1,i2,i3,i4}; arCombs[4] = {i10,i1,i2,i3,i4,i5}; arCombs[5] = {i1,i2,i3,i4,i5,i7}; arCombs[6] = {i1,i2,i3,i4,i7,i8}; arCombs[7] = {i1,i2,i3,i7,i8,i9}; arCombs[8] = {i1,i2,i7,i8,i9,i10}; arCombs[9] = {i1,i6,i7,i8,i9,i10}; arCombs[10] = {i5,i6,i7,i8,i9,i10}; }; I need to some help about syntax when i wrote this syntax i am giving a bug this like below: error C2059: syntax error : '{'

    Please stop this nonsense offer. I noticed about this offer is a statement against the enemy.

    D F 2 Replies Last reply
    0
    • H Hakan Bulut

      static int* arCombs[6][11] = { // Syntax error. arCombs[0] = {i1,i2,i3,i4,i5,i6}; arCombs[1] = {i7,i8,i9,i10,i1,i2}; arCombs[2] = {i8,i9,i10,i1,i2,i3}; arCombs[3] = {i9,i10,i1,i2,i3,i4}; arCombs[4] = {i10,i1,i2,i3,i4,i5}; arCombs[5] = {i1,i2,i3,i4,i5,i7}; arCombs[6] = {i1,i2,i3,i4,i7,i8}; arCombs[7] = {i1,i2,i3,i7,i8,i9}; arCombs[8] = {i1,i2,i7,i8,i9,i10}; arCombs[9] = {i1,i6,i7,i8,i9,i10}; arCombs[10] = {i5,i6,i7,i8,i9,i10}; }; I need to some help about syntax when i wrote this syntax i am giving a bug this like below: error C2059: syntax error : '{'

      Please stop this nonsense offer. I noticed about this offer is a statement against the enemy.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Have you considered:

      static int arCombs[11][6] =
      {
      {i1,i2,i3,i4,i5,i6},
      {i7,i8,i9,i10,i1,i2},
      {i8,i9,i10,i1,i2,i3},
      {i9,i10,i1,i2,i3,i4},
      {i10,i1,i2,i3,i4,i5},
      {i1,i2,i3,i4,i5,i7},
      {i1,i2,i3,i4,i7,i8},
      {i1,i2,i3,i7,i8,i9},
      {i1,i2,i7,i8,i9,i10},
      {i1,i6,i7,i8,i9,i10},
      {i5,i6,i7,i8,i9,i10}
      };

      BTW, unless you are strictly targeting German-speaking readers, you might want to consider changing your profile to English.

      "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

      H 1 Reply Last reply
      0
      • H Hakan Bulut

        static int* arCombs[6][11] = { // Syntax error. arCombs[0] = {i1,i2,i3,i4,i5,i6}; arCombs[1] = {i7,i8,i9,i10,i1,i2}; arCombs[2] = {i8,i9,i10,i1,i2,i3}; arCombs[3] = {i9,i10,i1,i2,i3,i4}; arCombs[4] = {i10,i1,i2,i3,i4,i5}; arCombs[5] = {i1,i2,i3,i4,i5,i7}; arCombs[6] = {i1,i2,i3,i4,i7,i8}; arCombs[7] = {i1,i2,i3,i7,i8,i9}; arCombs[8] = {i1,i2,i7,i8,i9,i10}; arCombs[9] = {i1,i6,i7,i8,i9,i10}; arCombs[10] = {i5,i6,i7,i8,i9,i10}; }; I need to some help about syntax when i wrote this syntax i am giving a bug this like below: error C2059: syntax error : '{'

        Please stop this nonsense offer. I noticed about this offer is a statement against the enemy.

        F Offline
        F Offline
        Florin Crisan
        wrote on last edited by
        #3

        I was about to suggest the code below, but then I've tried it in a compiler and I got an error.

        static int arCombs[6][11] =
        {
        {i1,i2,i3,i4,i5,i6},
        {i7,i8,i9,i10,i1,i2},
        {i8,i9,i10,i1,i2,i3},
        {i9,i10,i1,i2,i3,i4},
        {i10,i1,i2,i3,i4,i5},
        {i1,i2,i3,i4,i5,i7},
        {i1,i2,i3,i4,i7,i8}, // error C2078: too many initializers
        {i1,i2,i3,i7,i8,i9},
        {i1,i2,i7,i8,i9,i10},
        {i1,i6,i7,i8,i9,i10},
        {i5,i6,i7,i8,i9,i10}
        };

        The dimensions are wrong. You are declaring an array of 6 arrays of 11 elements, not an array of 11 arrays of 6 elements. But you only initialize 6 of those 11. The rest get the default value, 0. So the correct way should be:

        static int arCombs[6][11] =
        {
        {i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11},
        {i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11},
        {i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11},
        {i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11},
        {i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11},
        {i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11}
        };

        or even

        static int arCombs[6][11] =
        {
        i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,
        i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,
        i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,
        i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,
        i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,
        i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11
        };

        I just copied and pasted the values, but you get the picture ;)

        Florin Crisan

        1 Reply Last reply
        0
        • D David Crow

          Have you considered:

          static int arCombs[11][6] =
          {
          {i1,i2,i3,i4,i5,i6},
          {i7,i8,i9,i10,i1,i2},
          {i8,i9,i10,i1,i2,i3},
          {i9,i10,i1,i2,i3,i4},
          {i10,i1,i2,i3,i4,i5},
          {i1,i2,i3,i4,i5,i7},
          {i1,i2,i3,i4,i7,i8},
          {i1,i2,i3,i7,i8,i9},
          {i1,i2,i7,i8,i9,i10},
          {i1,i6,i7,i8,i9,i10},
          {i5,i6,i7,i8,i9,i10}
          };

          BTW, unless you are strictly targeting German-speaking readers, you might want to consider changing your profile to English.

          "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

          H Offline
          H Offline
          Hakan Bulut
          wrote on last edited by
          #4

          static int arCombs[11][6] = { {i1,i2,i3,i4,i5,i6}, {i7,i8,i9,i10,i1,i2}, {i8,i9,i10,i1,i2,i3}, {i9,i10,i1,i2,i3,i4}, {i10,i1,i2,i3,i4,i5}, {i1,i2,i3,i4,i5,i7}, {i1,i2,i3,i4,i7,i8}, {i1,i2,i3,i7,i8,i9}, {i1,i2,i7,i8,i9,i10}, {i1,i6,i7,i8,i9,i10}, {i5,i6,i7,i8,i9,i10} }; This is okey thanks..

          Please stop this nonsense offer. I noticed about this offer is a statement against the enemy.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups