it showing error when i declare an static array
it showing missing primary expression ] operatorCode:fun(int array1[],int array2[]) { array1 [] = { 12,3,5,3,2,7,3, 7,6,4,3,2,1,1}; array2 [] ={ 2,3,5,3,2,7,3, 9,6,4,3,2,1,1};
it showing error when i declare an static array
it showing missing primary expression ] operatorCode:fun(int array1[],int array2[]) { array1 [] = { 12,3,5,3,2,7,3, 7,6,4,3,2,1,1}; array2 [] ={ 2,3,5,3,2,7,3, 9,6,4,3,2,1,1};
Your arrays are already declared so you can't use the initialization list { ... } to initialize these arrays.
Jim
how to do initialisation then
You will either need to set each individual element to it's proper value:
Do the initialization when you declare the arrays using the initialization list:Code:array[0] = 12; array[1] = 3; // etc.
Or use another array:Code:int array1 [] = { 12,3,5,3,2,7,3, 7,6,4,3,2,1,1};
JimCode:void fun(int *array1) int array3 [] ={ 2,3,5,3,2,7,3, 9,6,4,3,2,1,1}; *array1 = *array3;
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
wat about C,the same prodecure like c++ or we can initialise