answersLogoWhite

0


Best Answer

There is no length function in C. You may have thought of sizeof or strlen. Perhaps.

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why use length function to find length of primitive data type array object?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Are arrays objects?

Yes. Arrays are objects in Java that store multiple variables of the same type. Arrays can hold either primitives or object references, but the array itself will always be an object on the heap, even if the array is declared to hold primitive elements. In other words, there is no such thing as a primitive array, but you can make an array of primitives


In java is A string the same thing as a char?

No.A char is a single Unicode character. It is stored as a primitive (i.e., non-object) data. A string can be considered as an array of chars - Java stores it as an object.No.A char is a single Unicode character. It is stored as a primitive (i.e., non-object) data. A string can be considered as an array of chars - Java stores it as an object.No.A char is a single Unicode character. It is stored as a primitive (i.e., non-object) data. A string can be considered as an array of chars - Java stores it as an object.No.A char is a single Unicode character. It is stored as a primitive (i.e., non-object) data. A string can be considered as an array of chars - Java stores it as an object.


Should element in an array must be of primitive data type?

No, it can be array, structure or union as well.


How can you create array of an object in java?

Array's can hold only primitive data types. if you want a collection of objects you must use an ArrayList or a Vector.


When an array contains values other than primitive data types is it considered a control array?

Only if the non-primitive data types are actually controls, such as an array of label controls, or an array of edit boxes. However, a control array is still an array. The only difference is that the values will likely be resource handles (objects that refer or point to the actual object which will be stored elsewhere in memory) rather than an actual value itself. That is, an array of primitive data types stores the actual value in the array itself.

Related questions

Are arrays objects?

Yes. Arrays are objects in Java that store multiple variables of the same type. Arrays can hold either primitives or object references, but the array itself will always be an object on the heap, even if the array is declared to hold primitive elements. In other words, there is no such thing as a primitive array, but you can make an array of primitives


In java is A string the same thing as a char?

No.A char is a single Unicode character. It is stored as a primitive (i.e., non-object) data. A string can be considered as an array of chars - Java stores it as an object.No.A char is a single Unicode character. It is stored as a primitive (i.e., non-object) data. A string can be considered as an array of chars - Java stores it as an object.No.A char is a single Unicode character. It is stored as a primitive (i.e., non-object) data. A string can be considered as an array of chars - Java stores it as an object.No.A char is a single Unicode character. It is stored as a primitive (i.e., non-object) data. A string can be considered as an array of chars - Java stores it as an object.


How do you accept an array in java?

Arrays are objects in Java that store multiple variables of the same type. Arrays can hold either primitives or object references, but the array itself will always be an object on the heap, even if the array is declared to hold primitive elements. In other words, there is no such thing as a primitive array, but you can make an array of primitives. Arrays are declared by stating the type of element the array will hold, which can be an object or a primitive, followed by square brackets to the left or right of the identifier. Declaring an array of primitives: int[] Values; // brackets before name (recommended) int Values []; // brackets after name (legal but less readable)


How delete an array of object within the object in C?

First locate the position of an array by search after than use a delete function to delete an array


Should element in an array must be of primitive data type?

No, it can be array, structure or union as well.


How can you create array of an object in java?

Array's can hold only primitive data types. if you want a collection of objects you must use an ArrayList or a Vector.


What is meant by the term array?

Arrays are objects in Java that store multiple variables of the same type. Arrays can hold either primitives or object references, but the array itself will always be an object on the heap, even if the array is declared to hold primitive elements. In other words, there is no such thing as a primitive array, but you can make an array of primitives. Arrays are declared by stating the type of element the array will hold, which can be an object or a primitive, followed by square brackets to the left or right of the identifier. Declaring an array of primitives: int[] Values; // brackets before name (recommended) int Values []; // brackets after name (legal but less readable) // spaces between the name and [] legal, but bad Declaring an array of object references: Ferrari[] Ferraris; // Recommended Ferrari Ferraris[]; // Legal but less readable When declaring an array reference, you should always put the array brackets immediately after the declared type, rather than after the identifier (variable name). That way, anyone reading the code can easily tell that, for example, Values is a reference to an int array object, and not an int primitive.


When an array contains values other than primitive data types is it considered a control array?

Only if the non-primitive data types are actually controls, such as an array of label controls, or an array of edit boxes. However, a control array is still an array. The only difference is that the values will likely be resource handles (objects that refer or point to the actual object which will be stored elsewhere in memory) rather than an actual value itself. That is, an array of primitive data types stores the actual value in the array itself.


How an array passed to a function?

Arrays should be passed by reference or by pointer, never by value (passing by value passes a copy of the reference, not the reference itself). The array length should also be passed to the function (by constant value) to prevent buffer overflows. Alternatively, in object-oriented languages, arrays can be wrapped in a class of object. Since the array is a member of the class, it doesn't need to be passed to the member methods, thus the function can become a member method of the class itself or a derivative of the class. Or the object containing the array can be passed to external functions by reference.


How many data types can the elements of an array have?

Depends on your language. Assuming java: If you make it an Object[] then it can contain any object For primitive types you must either make a primitive type array, ie double[], char[] which can contain only those primitives, or creater an Object[] and use primitive wrapper objects ie java.lang.Integer etc.


What is the difference between array in c and c sharp language?

The syntax to access a particular element in an array are the same in both languages: For example: assume array is an array of 10 int(egers): to get the first element: array[0] (both are 0 based indexing] int i = 0; while (i < array.Length) { // do something to array[i] } int i = 0; int length = sizeof(array) / sizeof(int); while (i < length) { // do something to array[i] } However, an array in C# is also enumerable (C does not have this feature) in C#, you may loop thru the array by: foreach (int number in array) { // do something to array[i] } Plus, C# is an Object-Oriented Language, so that an array may be of some object types, not just those primitiives data types in C: object[] objectArray; // any object derived from Object may be placed into objectArray, not just struct. In another variation, an array may be of Delegate type in C#(sort of like function pointers in C)


How do you pass a one-dimensional array to user-defined functions?

In C++ you would pass a std::array if the array is fixed-length, otherwise you'd use a std::vector. Most object oriented languages will provide some method of passing a self-contained array object to a function. In C and other non-object oriented languages you would pass a reference or pointer to the start address of the array along with a variable indicating the number of valid elements within the array. The array type will determine the size of each element.