Global Matrix

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eternalLearner
    New Member
    • May 2007
    • 35

    Global Matrix

    hi need to code a global matrix,whose size can only be defined at the run time.please tell me how to do the same ?
    thanks in advance
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    You will have to dynamically allocate the memory using pointers. The real question is, why do you need to use a global variable? 99/100 times, when I've programmed, I've never needed to use a global variable.

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Originally posted by Ganon11
      You will have to dynamically allocate the memory using pointers. The real question is, why do you need to use a global variable? 99/100 times, when I've programmed, I've never needed to use a global variable.
      The Matrix?

      kind regards,

      Jos ;-)

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        You will need to dynamically assign the size of the array.

        In C you use a global pointer and you do the allocation in main().

        In C++ you use a global object.

        The larger question is why global in the first place???

        Comment

        Working...