Hi!I want to use an array as a class member.I wrote something like this:
The compiler (Dev-C++) gave an error with the message "expected priimary - expression before '{' token : in the line // array[ 5 ] = { 0,1,2,3,4 }; // of the constructor.Code:class my_class{ public: .... int x; int array[5]; void function(); ..... } my_class::my_class() { .... x = 0; array[ 5 ] = { 0,1,2,3,4 }; } void my_class::function() { for( i = 0; i < 5; i++ ) { if ((something) > array[i] ) { do something.....; } } }
Any ideas...?
MaRaDoNa
========