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. 2D array

2D array

Scheduled Pinned Locked Moved C / C++ / MFC
databasedata-structureshelp
6 Posts 5 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.
  • R Offline
    R Offline
    ramamaru
    wrote on last edited by
    #1

    I don't think my query(on C) is directly related to this board..however i post it here cos of urgency... I wrote: -------------------------- #include void fun(int** x) { printf("%d",**x); } int main(void) { int a[2][2]={1,2,3,4}; fun(a); return 0; } -------------------------- to get '0' as output and not '1',i.e.the 1st element in the array. I ran this on TC 2.01. Help me if this is buggy. Thanx!

    D V T 3 Replies Last reply
    0
    • R ramamaru

      I don't think my query(on C) is directly related to this board..however i post it here cos of urgency... I wrote: -------------------------- #include void fun(int** x) { printf("%d",**x); } int main(void) { int a[2][2]={1,2,3,4}; fun(a); return 0; } -------------------------- to get '0' as output and not '1',i.e.the 1st element in the array. I ran this on TC 2.01. Help me if this is buggy. Thanx!

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

      ramamaru wrote:

      to get '0' as output and not '1',i.e.the 1st element in the array.

      How are you expecting to get '0' as an output. The array has four elements, none of which are '0'.


      "The largest fire starts but with the smallest spark." - David Crow

      "Judge not by the eye but by the heart." - Native American Proverb

      1 Reply Last reply
      0
      • R ramamaru

        I don't think my query(on C) is directly related to this board..however i post it here cos of urgency... I wrote: -------------------------- #include void fun(int** x) { printf("%d",**x); } int main(void) { int a[2][2]={1,2,3,4}; fun(a); return 0; } -------------------------- to get '0' as output and not '1',i.e.the 1st element in the array. I ran this on TC 2.01. Help me if this is buggy. Thanx!

        V Offline
        V Offline
        Velmont
        wrote on last edited by
        #3

        first your initializing the array incorrectly it should be [int a[2][2] = {{1,2},{3,4}};] ??to get '0' as output and not '1' you set the first element to 1 so what are you asking there.

        1 Reply Last reply
        0
        • R ramamaru

          I don't think my query(on C) is directly related to this board..however i post it here cos of urgency... I wrote: -------------------------- #include void fun(int** x) { printf("%d",**x); } int main(void) { int a[2][2]={1,2,3,4}; fun(a); return 0; } -------------------------- to get '0' as output and not '1',i.e.the 1st element in the array. I ran this on TC 2.01. Help me if this is buggy. Thanx!

          T Offline
          T Offline
          ThatsAlok
          wrote on last edited by
          #4

          ramamaru wrote:

          to get '0' as output and not '1',i.e.the 1st element in the array.

          but there is no zero In Array Inisialization List!

          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

          cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

          R 1 Reply Last reply
          0
          • T ThatsAlok

            ramamaru wrote:

            to get '0' as output and not '1',i.e.the 1st element in the array.

            but there is no zero In Array Inisialization List!

            "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

            cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

            R Offline
            R Offline
            ramamaru
            wrote on last edited by
            #5

            oh my God..i told that i got 0 as output...and not 1...Why? Thatz it

            S 1 Reply Last reply
            0
            • R ramamaru

              oh my God..i told that i got 0 as output...and not 1...Why? Thatz it

              S Offline
              S Offline
              Sebastian Pipping
              wrote on last edited by
              #6

              In case you still need help: I recommend reading this article which answered all my questions on arrays in the past. Statically- and dynamically-allocated arrays are stored differently - keep this in mind and it will help you to find the solution to your problem. Good luck, Sebastian ------------------------------------------- My website: http://www.hartwork.org

              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