Syntaxe pointeur structure et tableau
Salut,
je voudrai que 2 tableaux pointe vers les mêmes adresses
donc ...
Code:
1 2 3 4 5 6 7 8
| struct sPosistion
{ int HB=0;
int angle=0;
etc...
};
sPosistion Posistion[MaxX][MaxY];
sPosistion *Vec[MaxX*MaxY]=&Posistion[MaxX][MaxY]; |
et le passage :
Code:
1 2 3 4
| for(i=0;i<MaxX;i++)
{ for(j=0;j<MaxY;j++)
{ *Vec[id]=&Posistion[i][j];
id++; |
||=== Build: Debug in core2 (compiler: GNU GCC Compiler) ===|
C:\Users\david\Dropbox\code\AGK\DLL\core2\main.cpp|38|error: array must be initialized with a brace-enclosed initializer|
C:\Users\david\Dropbox\code\AGK\DLL\core2\main.cpp||In function 'void SetVector()':|
C:\Users\david\Dropbox\code\AGK\DLL\core2\main.cpp|55|error: no match for 'operator=' (operand types are 'sPosistion' and 'sPosistion*')|
C:\Users\david\Dropbox\code\AGK\DLL\core2\main.cpp|27|note: candidate: constexpr sPosistion& sPosistion::operator=(const sPosistion&)|
C:\Users\david\Dropbox\code\AGK\DLL\core2\main.cpp|27|note: no known conversion for argument 1 from 'sPosistion*' to 'const sPosistion&'|
C:\Users\david\Dropbox\code\AGK\DLL\core2\main.cpp|27|note: candidate: constexpr sPosistion& sPosistion::operator=(sPosistion&&)|
C:\Users\david\Dropbox\code\AGK\DLL\core2\main.cpp|27|note: no known conversion for argument 1 from 'sPosistion*' to 'sPosistion&&'|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
d'avance merci