About 2,980,000 results
Open links in new tab
  1. How to Take Input in Array in C++? - GeeksforGeeks

    Oct 5, 2023 · C++ Program to Take User Input in an Array using scanf() We can also use scanf() function to take input but then we have to specify the type of data and pass the address of the …

  2. C++ : Creating an array with a size entered by the user

    Feb 20, 2015 · I was wondering if we can make an array with a size specified by the user. Ex: int a; cout<<"Enter desired size of the array"; cin>>a; int array[a]; The above program won't work …

  3. How to User Input Array in Function in C++ - Delft Stack

    Feb 2, 2024 · This article will discuss how to create functions that accept user input to populate arrays in C++. Take User Input Array in a Function by Declaring a Global Array. To obtain the …

  4. C++ User Input - W3Schools

    C++ User Input. You have already learned that cout is used to output (print) values. Now we will use cin to get user input. cin is a predefined variable that reads data from the keyboard with …

  5. c++11 - initialise an array with user input - Stack Overflow

    Apr 2, 2015 · I want to know if there is a way to initialise an array, with input from the user, for example: I have an array: int arr[] = { 3, 7, 5, 9, 1}; . Therefore, I want the initialised values to …

  6. creating array with size determined by user input? - C++ Users

    Apr 21, 2011 · You cannot declare a variable-sized array like that. As for Abramus' suggestion, sounds good to me. Finally, this is how you create an array based on user's input:

  7. C++ Arrays - GeeksforGeeks

    May 14, 2025 · In C++, we can create/declare an array by simply specifying the data type first and then the name of the array with its size inside [] square brackets (better known as array …

  8. C++ Arrays (With Examples) - Programiz

    In C++, an array is a variable that can store multiple values of the same type. In this tutorial, we will learn to work with arrays in C++ with the help of examples.

  9. How to create an array from user input in C - Interview Sansar

    Aug 18, 2024 · Program to create an array from user input in C using dynamic memory allocation with malloc function.This program will create an integer array by allocating memory of size …

  10. c - Declaring arrays with user input elements - Stack Overflow

    Mar 27, 2014 · In C, when I declare an array of n elements a[n], and n is input by the user, it shouldn't work, because the array space will change from static memory to dynamic memory. …

Refresh