answersLogoWhite

0


Best Answer

Use a pointer...

int a*;

a = malloc(sizeof(int)*100); //allocate space for 100 elements

free(a);

a = malloc(sizeof(int)*1000); // allocate space for 1000 elements

free(a);

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can we create an unsized array to c programme?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How you create table in c language?

The simplest way to create a table in C is to use a two-dimensional array.


How can you store Class properties in Array in c?

Yes, you can create array that will store class properties. But all of them have to be of the same type.


How do you write a programme in c language using arrays to copy diagonal elements of a 2-d array into a 1-d array?

TO use a c language first step is to know about the c language and the steps to use the c progrmming language with the help of any elders or with the teachers. TO use the arrays you have to get th eknowledge of "c" language


How do you write a programme in c language using arrays to store a ten integer data and find the second smallest and second largest elements in the array?

void mail ( ); { int a, b c = a+b; printf ("%d",=c); }


How do you create a 2 multidimensional array of size 22 in C programming?

int x[22][22];


How do you use character in c plus plus?

If you are referring to the character object 'char,' then here are a couple of uses:To create an object, use this:char object = 'a';To create an array of chars, use this:char array[10];To dynamically allocate an array of chars, use this:char array = new char[10];(Don't forget to delete the object with 'delete [] array')


How do you use this function in c programme?

I don't use that function in C programme.


What is the array of string in c?

A string in C is stored in a 1 dimension array so an array of strings is simply a two dimension array.


What is the lowest subscript of an array in c plus plus?

The lowest subscript of an array in C, or C++ is 0.


How do you make a C plus plus program that arrange the the numbers in ascending order?

Heres something i whipped up in a hurry... This uses the Bubble Sort method found (related links) #include <iostream> using namespace std; int main(int argc, const char* argv) { int arraysize = 5; //Unsorted array size int array [] = { 5, 3, 4, 2, 1 }; //The array of numbers itself //Display the unsorted array cout << "Before: {"; for (int c=0; c <= arraysize; c++) { cout << array[c]; if (c != arraysize) { cout << ","; } } cout << "}" << endl; //Acctually sort the array int tmp=0; //Used for swaping values for (int loop=0; loop <= (arraysize - 1); loop++) { for (int c=0; c <= (arraysize - 1); c++) //The sort loop { if (array[c] > array[c + 1]) { //Swaps the two values in the array tmp = array[c]; array[c] = array[c + 1]; array[c + 1] = tmp; //Cleanup tmp = 0; } } } //Display the sorted array cout << "After: {"; for (int c=0; c <= arraysize; c++) { cout << array[c]; if (c != arraysize) { cout << ","; } } cout << "}" << endl; return 0; }


C plus plus array-based lists?

If you mean an array where each element is a list, then the STL is your friend. To create an array of lists of any type T, use the following declaration: std::vector<std::list<T>> my_array_of_lists;


How do you declare a string array and add elements to it in C plus plus?

You cannot add elements to a fixed array in C or C++. If, however, the array is declared as a pointer to an array, you can add elements by allocating a new array, copying/adding elements as needed, reassigning the new array to the pointer, and deallocating the original array.