0

Array Properties & Methods problem with compiler

Hello. While solving Maximum And Minimum exercise I have compiler error: ./Playground/file0.cs(15,20): error CS0650: Bad array declarator: To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed size buffer field, use the fixed keyword before the field type. but my array declaration is correct. My code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { //your code goes here int num[] = new int[5]; int x = 0; while(x<5){ num[x] = Convert.ToInt32(Console.ReadLine()); x++; } Console.Write(num.Min()+num.Max()); } } } Someone had that problem too? Some idea to fix it? I can't continue course without pass that

1st Jun 2023, 2:45 PM
Kamil Kuształa
1 Resposta
+ 8
Hello Kamil, It's a minor issue. you just misplaced the array specifier [] symbol. It needs to be placed between the array's content type `int`, and the identifier (variable name) <num>, as follows: int[] num = new int[ 5 ];
1st Jun 2023, 3:09 PM
Ipang