+ 1
import java.util.*;
public class Program
{
public static void main(String[] args) {
int arr[];
Scanner sc=new Scanner(System.in);
System.out.println("enter the size of the array");
int s=sc.nextInt();
arr=new int[s];
}
}
0
You can't declare an array with variable size in C unless you (re)allocate the memory manually as far as I know.
For java you can just define the array (int array[];) and then declare it later (array = new int[size];) with size being for example a number entered by the user.



