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. A simple array question

A simple array question

Scheduled Pinned Locked Moved C / C++ / MFC
questiondatabasedata-structureshelp
8 Posts 4 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.
  • N Offline
    N Offline
    ns
    wrote on last edited by
    #1

    And its confounding me... I have an array Arr in which I stored the values of 1 row of a database, and the size of this is the number of fields n. Now I want to send this off to a function in a parameter list like myFunc(Arr[0], Arr[1], Arr[2],....,Arr[n-1]) I cant do a for n =0, n++ type loop since I need them all at once> So what is the way to go here? Appreciate your help, ns

    R J 2 Replies Last reply
    0
    • N ns

      And its confounding me... I have an array Arr in which I stored the values of 1 row of a database, and the size of this is the number of fields n. Now I want to send this off to a function in a parameter list like myFunc(Arr[0], Arr[1], Arr[2],....,Arr[n-1]) I cant do a for n =0, n++ type loop since I need them all at once> So what is the way to go here? Appreciate your help, ns

      R Offline
      R Offline
      RedZenBird
      wrote on last edited by
      #2

      why can't you just pass in the entire array to myFunc? Seems like that what you want.... Just trying to keep the forces of entropy at bay

      N 1 Reply Last reply
      0
      • R RedZenBird

        why can't you just pass in the entire array to myFunc? Seems like that what you want.... Just trying to keep the forces of entropy at bay

        N Offline
        N Offline
        ns
        wrote on last edited by
        #3

        The function demands that the parameters be fed in as I showed....I cant change that. Otherwise your idea is great! Appreciate your help, ns

        J 1 Reply Last reply
        0
        • N ns

          The function demands that the parameters be fed in as I showed....I cant change that. Otherwise your idea is great! Appreciate your help, ns

          J Offline
          J Offline
          jmkhael
          wrote on last edited by
          #4

          does the function takes a limited or variable number of parameters? i mean is it like printf ?? Papa while (TRUE) Papa.WillLove ( Bebe ) ;

          N 1 Reply Last reply
          0
          • J jmkhael

            does the function takes a limited or variable number of parameters? i mean is it like printf ?? Papa while (TRUE) Papa.WillLove ( Bebe ) ;

            N Offline
            N Offline
            ns
            wrote on last edited by
            #5

            Nope, fixed number of variables Appreciate your help, ns

            1 Reply Last reply
            0
            • N ns

              And its confounding me... I have an array Arr in which I stored the values of 1 row of a database, and the size of this is the number of fields n. Now I want to send this off to a function in a parameter list like myFunc(Arr[0], Arr[1], Arr[2],....,Arr[n-1]) I cant do a for n =0, n++ type loop since I need them all at once> So what is the way to go here? Appreciate your help, ns

              J Offline
              J Offline
              Joe Herbert
              wrote on last edited by
              #6

              you could change it from this myFunc(Arr[0], Arr[1], Arr[2],....,Arr[n-1]) to this i=0 ; myFunc(Arr[i], Arr[++i], Arr[++i],....,Arr[++i]) I'm new here, pardon the n00bing

              N 1 Reply Last reply
              0
              • J Joe Herbert

                you could change it from this myFunc(Arr[0], Arr[1], Arr[2],....,Arr[n-1]) to this i=0 ; myFunc(Arr[i], Arr[++i], Arr[++i],....,Arr[++i]) I'm new here, pardon the n00bing

                N Offline
                N Offline
                ns
                wrote on last edited by
                #7

                Thnaks. Welcome to CP :) Appreciate your help, ns

                J 1 Reply Last reply
                0
                • N ns

                  Thnaks. Welcome to CP :) Appreciate your help, ns

                  J Offline
                  J Offline
                  jmkhael
                  wrote on last edited by
                  #8

                  This doesnt work i fear cos i++ isnt yet evaluated Papa while (TRUE) Papa.WillLove ( Bebe ) ;

                  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