answersLogoWhite

0


Best Answer

in c simply add three lines in the begining of your program:

int x;

printf("enter the size of the array to be entered :");

scanf("%d",&x);

after that use x as your maximum limit of array in your program.

in c++ just replace above printf & scanf statements by

cout<<"enter the size of the array to be entered :";

&

cin>>x;

respectively and do not use brackets.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How you get the size of arrays from user?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the way by which you can make the user defined the size of the arrays?

By using the library function #define A[] we can define the size of arrays


Arrays whose size can be altered are known as?

Arrays whose size can be altered are known as dynamic arrays.


Can an arrays size declarator be negative?

no


How can arrays be used for inter function communication?

The size of a function can be determined from the size of the array. Arrays and functions are both used in computer programming.


What is the required syntax for creating C arrays?

The required syntax for creating C arrays include the brackets, array size, variety length arrays, codes like std:vector, classPTR, and many more to create C arrays.


Is an array is a collection of characters that can be fixed or variable?

No. An array is a collection of objects of any type, such as doubles, not just characters. You can even have arrays of arrays, or arrays of structs. In C, the size of an array is fixed, but it is possible to write code that will allow you to manually make it variable in size.


What is memory leakage in terms of arrays?

leakage in arrays occur when you declare an array with big size and using only very few bytes.


1 write a c function that takes a parameters two integer arrays and their sizeboth arrays are of the same size and returns a 1true if the arrays have the same contents or a 0 false if not?

int comp(const int a1[], const int a2[], const int size) { int i; for(i = 0; i &lt; size; ++i) { if(a1[i] != a2[i]) { return 0; } } return 1; }


What number has the most arrays?

You have array of type int with a name myArray, and you do not know size of the array.


Is struct is user defined data type?

yes, a structure is a user-made data type so that user can manipulate multiple data types simultaneously. a structure covers up sum limitation of arrays as in it provides heterogenous data type.


What is multidimentional array?

Arrays having more than one dimension is known as multi-dimensional arrays. Multi-dimensional arrays is also known as arrays-of-arrays.


What is a multidimentional array?

Arrays having more than one dimension is known as multi-dimensional arrays. Multi-dimensional arrays is also known as arrays-of-arrays.