I'm really confused what your asking. you want a global array--just define it 
outside the function, as you did.

Thanks,
_|_|_|_|_|  _|        _|_|_|_|            
    _|      _|_|_|    _|          _|_|_|  
    _|      _|    _|  _|_|_|    _|        
    _|      _|    _|  _|        _|        
    _|      _|    _|  _|_|_|_|    _|_|_|  
Visit TDS for quality software and website production
http://tysdomain.com
msn: [EMAIL PROTECTED]
aim: st8amnd2005
skype: st8amnd127
  ----- Original Message ----- 
  From: Miguel Caro 
  To: [email protected] 
  Sent: Wednesday, October 08, 2008 6:15 PM
  Subject: [c-prog] dynamic array as global variables to use in a function



  Hello everybody,

  well i wish to ennounce two global variables to use after in a function.
  One variable i define as an unidimensional vector. I did it very well, i
  think so, the variable is called x[].
  But i wish to define a new global variable, as bidimensional dynamic array, 
  is called a[][]. But i don't know how to define this dynamic array a[][] as
  global variable.

  I knwo how to define dynamica array(unidimensional or bidimensional) inside
  the main program or inside any function, but as a global variable?

  It is important to remark that i have defined in my program three or more
  functions whose one of incoming variables is a bidimeniosnal dynamic
  array.

  Next i post a part of program
  Any help it is important to me.
  Thank You all,
  Miguel.

  Program
  using namespace std;
  float a[16][16];//in this part i wish define the bidimensional dynamic
  array

  //i'm defining unidimensional dynamic array x
  const N=1000;
  float* x = new float[N];
  //first function using dynamic array x[]

  float suma3(float x[])
  {
  int j; float s=0.0;
  for (j=1;j<16;j++)
  s=s+x[j];
  return(s);
  }
  //second function i wish , for example here, usin a[][] as bidimensional
  dynamic array. how to do?
  float suma1(int i, float x[], float a[][16])
  {
  int l;
  float s=0;
  for (l=1;l<i;l++)
  {
  s=s+a[i][l]*x[l];
  }
  return(s);
  }///fin suma 1

  -- 
  View this message in context: 
http://www.nabble.com/dynamic-array-as-global-variables-to-use-in-a-function-tp19813653p19813653.html
  Sent from the C-prog mailing list archive at Nabble.com.

  [Non-text portions of this message have been removed]



   

  __________ NOD32 3505 (20081008) Information __________

  This message was checked by NOD32 antivirus system.
  http://www.eset.com


[Non-text portions of this message have been removed]

Reply via email to