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. REFERENCE TO ARRAY OF 10 INTEGERS

REFERENCE TO ARRAY OF 10 INTEGERS

Scheduled Pinned Locked Moved C / C++ / MFC
data-structurestestingbeta-testingtutorial
10 Posts 7 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.
  • A Offline
    A Offline
    avenger_sb25
    wrote on last edited by
    #1

    Please give me an example/syntax of: REFERENCE TO ARRAY OF 10 INTEGERS Maybe it is very eazy but my super genius stops working for eazy questions... :( ...:doh: ...Avenger


    Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs

    J M M 3 Replies Last reply
    0
    • A avenger_sb25

      Please give me an example/syntax of: REFERENCE TO ARRAY OF 10 INTEGERS Maybe it is very eazy but my super genius stops working for eazy questions... :( ...:doh: ...Avenger


      Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs

      J Offline
      J Offline
      Jaime Stuardo
      wrote on last edited by
      #2

      int a[10]; void fn(int &a) { } Jaime

      A 1 Reply Last reply
      0
      • J Jaime Stuardo

        int a[10]; void fn(int &a) { } Jaime

        A Offline
        A Offline
        avenger_sb25
        wrote on last edited by
        #3

        I tried the same myself but i get a bad error WITH THIS....

        int fn(int&a)
        {
        }
        int main(int argc, char* argv[])
        {
        int abb[10];
        fn(abb);
        return 0;
        }

        ERROR: C:\Windows\Desktop\a\a.cpp(19) : error C2664: 'fn' : cannot convert parameter 1 from 'int [10]' to 'int &' A reference that is not to 'const' cannot be bound to a non-lvalue ...Avenger


        Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs

        K 1 Reply Last reply
        0
        • A avenger_sb25

          I tried the same myself but i get a bad error WITH THIS....

          int fn(int&a)
          {
          }
          int main(int argc, char* argv[])
          {
          int abb[10];
          fn(abb);
          return 0;
          }

          ERROR: C:\Windows\Desktop\a\a.cpp(19) : error C2664: 'fn' : cannot convert parameter 1 from 'int [10]' to 'int &' A reference that is not to 'const' cannot be bound to a non-lvalue ...Avenger


          Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs

          K Offline
          K Offline
          Kochise
          wrote on last edited by
          #4

          fn(abb[0]); // Get the address of the first cell, must work Kochise In Code we trust !

          1 Reply Last reply
          0
          • A avenger_sb25

            Please give me an example/syntax of: REFERENCE TO ARRAY OF 10 INTEGERS Maybe it is very eazy but my super genius stops working for eazy questions... :( ...:doh: ...Avenger


            Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs

            M Offline
            M Offline
            Michael Dunn
            wrote on last edited by
            #5

            int[10]& ? --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- "Linux is good. It can do no wrong. It is open source so must be right. It has penguins. I want to eat your brain."   -- Paul Watson, Linux Zombie

            A 1 Reply Last reply
            0
            • A avenger_sb25

              Please give me an example/syntax of: REFERENCE TO ARRAY OF 10 INTEGERS Maybe it is very eazy but my super genius stops working for eazy questions... :( ...:doh: ...Avenger


              Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs

              M Offline
              M Offline
              markkuk
              wrote on last edited by
              #6

              I'm too lazy to look this up from a C++ reference, so I'll let the computer answer:

              $ c++decl
              Type `help' or `?' for help
              c++decl> declare a as reference to array 10 of int
              int (&a)[10]
              c++decl>

              :)

              A 1 Reply Last reply
              0
              • M markkuk

                I'm too lazy to look this up from a C++ reference, so I'll let the computer answer:

                $ c++decl
                Type `help' or `?' for help
                c++decl> declare a as reference to array 10 of int
                int (&a)[10]
                c++decl>

                :)

                A Offline
                A Offline
                avenger_sb25
                wrote on last edited by
                #7

                THANX A LOT 'markkuk'. U are a GENIUS (i mean ur computer) It works. Please please please tell me in which book did u find that syntax.... I was reading C++ from Stroupstrup and in fact... that was a question from the exercises of chapter-5. But i cudnt dig out that particular syntax. thanx. ...Avenger


                Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs

                B 1 Reply Last reply
                0
                • M Michael Dunn

                  int[10]& ? --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- "Linux is good. It can do no wrong. It is open source so must be right. It has penguins. I want to eat your brain."   -- Paul Watson, Linux Zombie

                  A Offline
                  A Offline
                  avenger_sb25
                  wrote on last edited by
                  #8

                  no... this is wrong... i am happy that markuk has given the corect answer. Take a look at his reply. :) thanx anyway ...Avenger


                  Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs

                  1 Reply Last reply
                  0
                  • A avenger_sb25

                    THANX A LOT 'markkuk'. U are a GENIUS (i mean ur computer) It works. Please please please tell me in which book did u find that syntax.... I was reading C++ from Stroupstrup and in fact... that was a question from the exercises of chapter-5. But i cudnt dig out that particular syntax. thanx. ...Avenger


                    Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs

                    B Offline
                    B Offline
                    bikram singh
                    wrote on last edited by
                    #9

                    It is really quite easy to decipher, or create, any simple or complex C/C++ decl, once you know how.. Ever heard of the "right-left rule" ? Again, google is your best friend... Bikram Singh

                    A 1 Reply Last reply
                    0
                    • B bikram singh

                      It is really quite easy to decipher, or create, any simple or complex C/C++ decl, once you know how.. Ever heard of the "right-left rule" ? Again, google is your best friend... Bikram Singh

                      A Offline
                      A Offline
                      Anonymous
                      wrote on last edited by
                      #10

                      Thank you bikram singh.... YOU ARE MY BEST FRIEND. 'right-left' rule was a BLAST. i dont know how i missed to learn it.... ANYWAY... now i am a genius too.... thanx a lot:rose:

                      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