Go Back   Armenian Knowledge Base > Technical sections > Languages, Compilers, Interpreters

Reply
 
Thread Tools

Matrixes n Functions
Old 25.07.2002, 08:08   #1
Студент
 
Join Date: 03 2002
Location: [ Surrealistical World ]
Posts: 312
Rep Power: 0
Post Matrixes n Functions

How do we pass a matrix as an argument to a function WITHOUT USING POINTERS??

Thx

Old 25.07.2002, 11:38   #2
Студент
 
Join Date: 06 2002
Location: Yerevan
Posts: 258
Rep Power: 0
Post

What do you mean by "matrix"? I mean what c++ construction?

And what's the reason you don't wanna use pointers (or arrays, which are basically the same)??

Just final note, whatever you use (unless you assign a separate variable to each element), it will contain pointers in some form.
__________________
http://www.d-brane.com

Old 26.07.2002, 07:03   #3
Студент
 
Join Date: 03 2002
Location: [ Surrealistical World ]
Posts: 312
Rep Power: 0
Post

Matrix = 2D [two-dimensional] array.

|g0t n0 time t0 write m0re]

Old 26.07.2002, 08:03   #4
Студент
 
Join Date: 06 2002
Location: Yerevan
Posts: 258
Rep Power: 0
Post

You have to use pointers.

Old 26.07.2002, 08:32   #5
Студент
 
Join Date: 03 2002
Location: [ Surrealistical World ]
Posts: 312
Rep Power: 0
Post

Read my first message.

Old 26.07.2002, 08:37   #6
Студент
 
Join Date: 06 2002
Location: Yerevan
Posts: 258
Rep Power: 0
Post

You have to use pointers.
In other words this means - NO way.

All ways I can think of involves pointers in this or other form - pointers, arrays, even functions with indefinite number of arguments, etc.
Reason - to store an array in a program you never store each element in a different variable, you just store the start position, and then just do small steps to get others, or store a link in each element to the other one.

P.S. Maybe I'm not getting your question right, so you should consider rephrasing it, showing the cpp code of the matrix you want to pass and then asking the same question.

Old 27.07.2002, 19:08   #7
Младенец
 
Join Date: 07 2002
Location: Yerevan
Posts: 28
Rep Power: 0
Post

Create a class that incapsulates 2D matrix functionality and write copy constructor.

But I would not recommend doing it because will work very inefficient(big object copying), the same result can be achieved by using const Matrix& as an argument to the function instead.
Reply




Реклама:
реклама
Buy text link .

All times are GMT. The time now is 09:12.
Top

Powered by vBulletin® Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.