What are the data types for which it is not possible to create an array? Last Updated : 18 Dec, 2024 Comments Improve Suggest changes Like Article Like Report In C, an array is a collection of variables of the same data type, stored in contiguous memory locations. Arrays can store data of primitive types like integers, characters, and floats, as well as user-defined types like structures.However, there are certain data types for which arrays cannot be directly created due to the nature of those types. Data types for which arrays cannot be created are:Table of ContentFunction TypesVoid TypeFunction TypesIn C, we cannot create an array of functions, as the function type is not a variable type. Functions are used to define behaviour, not to hold data. Doing so will throw an error as shown in the given example: C #include <stdio.h> void func() { // Some code } int main() { // Create an array void (*arr)[1]() = {func}; } Outputsolution.c: In function ‘main’: solution.c:10:12: error: declaration of ‘arr’ as array of functions 10 | void (*arr)[1]() = {func}; | ^~~Explanation: The compiler cannot treat a function as a data object that can be stored in memory like integers or floats. Instead, functions are referenced by their addresses when needed, but they cannot be stored as array elements.Void TypeThe void data type represents the absence of a value, and it cannot hold any data. Arrays require a specific type of data to store, and void does not hold any value to be stored in an array.Let's take a look at an example: C #include <stdio.h> void func() { // Some code } int main() { // Create an array void arr[10]; return 0; } Outputsolution.c: In function ‘main’: solution.c:10:10: error: declaration of ‘arr’ as array of voids 10 | void arr[10]; | ^~~Explanation: A void type is used for functions that do not return a value or for pointers, but it cannot be used to store a sequence of elements, as it lacks a data representation. Comment More infoAdvertise with us S Shiva Improve Article Tags : C Language cpp-data-types cpp-array C Array and String Similar Reads C Arrays An array in C is a fixed-size collection of similar data items stored in contiguous memory locations. It can be used to store the collection of primitive data types such as int, char, float, etc., as well as derived and user-defined data types such as pointers, structures, etc. Creating an Array in 7 min read Properties of Array in C An array in C is a fixed-size homogeneous collection of elements stored at a contiguous memory location. It is a derived data type in C that can store elements of different data types such as int, char, struct, etc. It is one of the most popular data types widely used by programmers to solve differe 8 min read Length of Array in C The Length of an array in C refers to the maximum number of elements that an array can hold. It must be specified at the time of declaration. It is also known as the size of an array that is used to determine the memory required to store all of its elements.In C language, we don't have any pre-defin 3 min read Multidimensional Arrays in C - 2D and 3D Arrays A multi-dimensional array in C can be defined as an array that has more than one dimension. Having more than one dimension means that it can grow in multiple directions. Some popular multidimensional arrays include 2D arrays which grows in two dimensions, and 3D arrays which grows in three dimension 8 min read Initialization of Multidimensional Array in C In C, multidimensional arrays are the arrays that contain more than one dimensions. These arrays are useful when we need to store data in a table or matrix-like structure. In this article, we will learn the different methods to initialize a multidimensional array in C. The easiest method for initial 4 min read Jagged Array or Array of Arrays in C with Examples Prerequisite: Arrays in CJagged array is array of arrays such that member arrays can be of different sizes, i.e., we can create a 2-D array but with a variable number of columns in each row. These type of arrays are also known as Jagged arrays. Example:arr[][] = { {0, 1, 2}, {6, 4}, {1, 7, 6, 8, 9}, 3 min read Pass Array to Functions in C Passing an array to a function allows the function to directly access and modify the original array. In this article, we will learn how to pass arrays to functions in C.In C, arrays are always passed to function as pointers. They cannot be passed by value because of the array decay due to which, whe 3 min read How to pass a 2D array as a parameter in C? A 2D array is essentially an array of arrays, where each element of the main array holds another array. In this article, we will see how to pass a 2D array to a function.The simplest and most common method to pass 2D array to a function is by specifying the parameter as 2D array with row size and co 3 min read How to pass an array by value in C ? In C programming, arrays are always passed as pointers to the function. There are no direct ways to pass the array by value. However, there is trick that allows you to simulate the passing of array by value by enclosing it inside a structure and then passing that structure by value. This will also p 2 min read Variable Length Arrays (VLAs) in C In C, variable length arrays (VLAs) are also known as runtime-sized or variable-sized arrays. The size of such arrays is defined at run-time.Variably modified types include variable-length arrays and pointers to variable-length arrays. Variably changed types must be declared at either block scope or 2 min read Like