What is Arrays: Definition and 151 Discussions

An array is a systematic arrangement of similar objects, usually in rows and columns.
Things called an array include:

View More On Wikipedia.org
  1. S

    Fortran Merging arrays in fortran 90/95

    Hi, can someone help me with this one? I'm trying to merge several 1d-arrays into one 2d-array. Is there any intrinsic routine/function in fortran 90/95 to do so? I also thought of pointers. Can I assign a 2d-pointer to more than one object so I have a pointer array whose columns point to...
  2. A

    Adding Arrays Together with Pointers in C

    #include <stdio.h> #define K 10 int array1[K], array2[K]; int *ptr; int addarrays(int x[],int y[]); main() { int count; for (count = 0;count < K; count++) { puts("Enter numbers into array1"); scanf("%d", array1[count]); }...
  3. J

    PHP PHP Constant Arrays: Is It Possible?

    I was wondering if was possible to create a constant array in php so it doesn't have to be reinitialized each time you enter a function. I guess one solution is to make it global but from a code maintenance perspective it makes since to put the array in with the function that uses it.
  4. D

    Writing down Mathematics with Arrays

    I know how to do basic matrix operations, but sometimes I do calculations on computers and do array operations. How do I write down array operations on paper? For example, say I have two matrices, A and B, and I want to multiply them element by element.
  5. S

    Comp Sci How can I print integers as a string in C++ using character arrays?

    Homework Statement I have a bunch of integers stored in a character array, and I am trying to print the integers as characters. I can print them as characters when I use %c in the print statement, but the problem is I need to print them as a string. My program crashes when I attempt to use...
  6. Saladsamurai

    Anyone use VBA in Excel: eclaring Arrays as Public

    Anyone use VBA in Excel::Declaring Arrays as Public Egads man...I have seen plenty of modules with arrays declared as Public. Clearly I am making some boneheaded error here and cannot locate it: Any Thoughts?
  7. K

    MATLAB Matlab arrays with numbers and characters

    So, I'm trying to create an array with both numbers and specific characters, like # and C. I want it to be displayed like a standard array of numbers. So the output would resemble. 7 7 7 7 7 7 7 6 6 6 6 6 6 6 5 # C 6 6 @ 6 Thanks,
  8. S

    Returning arrays from a function

    hello. I am working on a c++ assignment right now, and my job is to write a sub-program that will fill two arrays with random numbers (1-10), then ask the student 10 arithmetic questions (either multiply or divide depending on a previous choice) and store the answers in a third arrray. I come...
  9. A

    Can arrays be combined into a matrix for more efficient coding?

    Hello, Currently I have two single dimension arrays. I am interested to know if I can modify program by combining them to a matrix giving same result. E.g. A(X), B(Y) used for M=P*A(1)+Q*B(2) Proposed- A(X,Y) used for M=P*A(1,Y)+Q*B(X,2) Program should understand that it has to...
  10. O

    Creating Multi-Indexed Arrays & Functions w/ Array Inputs & Outputs

    How do i create an array such that there is more than one index? the array declared here float array[i]; is like a vector but how do i create an array that is declared such as float array[i,j] which would be a matrix And how do i create a c function whose input is an array and the...
  11. S

    MATLAB Matlab: Plotting loops, arrays

    Hello, I am trying to store the results in the form of an array every time the code goes through a loop. This is what my code looks like: for j = 1:100 for i= 1:100 if S(i)==0 if rand < T S(i)= 1; t_inf(i) = j; end...
  12. E

    [Problem] C, Mingw32 - arrays impact each other (changing values)

    About week ago I decided to make an attept to create multiplayer rpg game in j2me. The game needs server so I use c and mingw32 as compiler. I thought the biggest problem will be network programming as I never tried that before. But the j2me client is connecting nicely I have managed to get...
  13. R

    Fortran How can I read and write 3D arrays in Fortran?

    Hi! I have a 3D array u(n,m,2), where n=2000, m=200 are the xy-coordinates, and u(n,m,1) and u(n,m,2) store values of variables a and b computed at the coordinates. (not very familiar with fortran I/O for arrays, when new lines are started, etc). I'd like to output this array into a...
  14. J

    Recursive methods for arrays

    Homework Statement Ok. I am supposed to write a recursive method for the following: 1) public static double computeSumAtOdd(double[] numbers, int startIndex, int endIndex) - finds the sum at all the odd indexes of the array 2) public static double computePositiveSum(double[] numbers...
  15. djeitnstine

    How to Reverse Words in Strings Using Multidimensional Arrays in C?

    Hi guys I just learned M-D arrays and was trying to execute this piece of code: //initial value of y printf("\nTime of initial displacement - y(t): t="); fflush(stdin); scanf("%lf", &IVP[1][1]); printf("\nInitial displacement - y(%.4lf)=",&IVP[1][1]); fflush(stdin)...
  16. C

    MATLAB Combining 2 two-dimensional cell arrays in MATLAB

    Hi I'm quite new to MATLAB and I'm stuck on a problem which I think is probably relatively simple. Any help much appreciated! Right, I have 2 cells, both of dimension 51x1 called n_cbc and n_load. Each of the 51 rows in the n_cbc cell contains a 5x1 matrix. Each of the 51 rows in the...
  17. P

    Java Why is My Java Code Not Rotating an Array 90 Degrees to the Left?

    I am supposed to write code to rotate an array 90 degrees to the left... so my question is, why is this code not rotating my array 90 degrees to the left? thanks for any help! public static int[][] rotateLeft(int[][] source) { int[][] result = new int[source.length][source[0].length]...
  18. P

    Comp Sci Rotate Arrays in Java: Troubleshooting 90 Degree Left Rotation Code

    Homework Statement Write code to rotate an array... Homework Equations why is this code not rotating my array 90 degrees to the left? thanks SO much in advance! The Attempt at a Solution public static int[][] rotateLeft(int[][] source) { int[][] result = new...
  19. I

    Java Need help setting up arrays for Galton box simulation?

    I'm new in java and I'm trying to come up with a program that stimulates the bean machine(also known as Galton box) Balls are dropped from the opening of the board. Everytime a ball hits, there is a 50% chance to fall to left and 50% chance to fall to the right. the piles of balls are...
  20. S

    Comp Sci How can I initialize 2D arrays in C++ to avoid gibberish output?

    I need to initialize the arrays of an object to zero, but when I compile it, it gives me gibberish. Here's my code:
  21. S

    Fortran 90 (need to read in binary data files into arrays)

    Hello, I am currently doing a 3rd year undergrad project on forward radio meteor scatter the problem involves the following: I have over 80Gbs worth of 10 second data blocks of recorded radio input. They are stored as date stamped .bin files in binary format, each of order 1700kb or...
  22. R

    Working with char arrays - Solving Array Problems with Rui's Help

    Hi there! I'm having problems with creating/using char arrays. My actual code is: (I reduced the options to make it smaller here..) int option; int i; fs=11025; %frequency %load wave files into MATLAB vectors [jose]=wavread('jose.wav'); [antonio]=wavread('antonio.wav')...
  23. N

    Comp Sci Depreciation Calculator in C++: Calculate Values & Validate Data Using Arrays

    My Homework is write a program to show the depreciation of an item each year during 10 years, for a porcentage given. The prgram shoul include: 1- Data entry validation 2-Calculate all the values for each year,and tehn of calculate all the values should show de results. 3-If the final value...
  24. N

    Comp Sci Depreciation Program in C++ with arrays

    Hi, i have did my program ccorrectly, but my profesor ask me to do with arrays and i don't know how to do thisprogram wuth arrays. Can anyone helps please?... I talk with my profesor and see my prgram, and told me that it is all ok , but the only mistake is that i don't use arrays how the work...
  25. C

    Comparing Arrays Homework: Subsequence Function

    Homework Statement OK, so in this CS project, we need to make functions for arrays. I need to implement a function that does the following: int subsequence(const string a1[], int n1, const string a2[], int n2); If all n2 elements of a2 appear in a1, consecutively and in the same order...
  26. S

    C Newbie Help: Strings, Arrays, Getline() & Sscanf() - Urgent (Due Monday)

    I am required to use getline() and sscanf() somewhere in my function to read standard input and store it into arrays. I have input like this: 10/10/08 12:00 A1:2.31:1:P 2B:1.98:2:g 2b:1.82:3:b the first line is the time, which i used strcpy to copy it to an array called time[] the...
  27. T

    C/C++ Need help soon with C++ program using pointers and arrays

    Okay so I got the majority of my program complete, however when I try to run it it doesn't display the proper value of the average. I think I somehow messed up using my pointers and arrays, but I can't locate the problem and I've spent hours trying to fix it to no avail. see comments for better...
  28. R

    Calculating Vibration in Water Flowing Pipes for Noise Comparison

    Hi, Does anyone know how to calculate the vibration in a pipe with water flowing through it? I have no idea where to start or what formula to use. Any help would be appreciated. Thanks.
  29. L

    Can you explain the size difference between arrays and pointers in C?

    int* a1 = malloc(4 * sizeof(int)); int* a2 = malloc(3 * sizeof(int)); int* a3 = malloc(5 * sizeof(int)); a1[0] = 1; a1[1] = 2; a1[2] = 3; a1[3] = 4; a2[0] = 9; a2[1] = 8; a2[3] = 7; a3[0] = -1; a3[1] = -2; a3[2] = -3; a3[3] = -4; a3[4] = -5; My question: Are a1, a2 and a3 arrays? I...
  30. T

    Help! Struggling to Grasp Arrays and Strings for Final Exam

    My final exam is tuesday and I am having an extremely extremely hard time grasping arrays and strings. I just can't visualize how they work and I am stuck on how to get my printOwnedShares function to work properly in a project that will help me study for the final. This is what I have worked on...
  31. M

    Problem with string arrays in assembly

    I have been working with assembly (TASM32) for a few months now and have ran into a problem which I cannot fix. Here's a working example written in C++ which needs to be converted to assembly. #include <windows.h> int main(){ char *name_list[5] = {"Micheal", "Stefan", "Judy", "William"...
  32. A

    How to Assign Inputs as Addresses in C Programming?

    Hi guys, ***I just started c programming, I've done some reading last week and i came up with a basic program.Ive got a problem trying to assign an input as an adress to a specified value.Basically i have 3 datas in my array and it will be called by inputting a number which points to the...
  33. S

    Set Elements of Array to Same Value in C#

    For some reason, I can't work out how to set every element of an array to the same value in a single line, in C#. For example, I can't do this: char[] array_of_chars = new char[limit]; array of chars[] = X or: char[] array_of_chars = new char[limit]; array of chars[0:limit] = X So...
  34. O

    Java How to Count Rows and Columns in a Two-Dimensional Array in Java?

    I just have a question about my "solution" to a problem. The question says to write a value returning method that returns the number of rows in a two-dimensional array of doubles. It should be simple enough and so I did it like this: public int countRows() { int x; x = 0; for (int...
  35. C

    GCC & C++: Allocating Large Arrays in Windows

    I'm having trouble allocating large arrays in C++ using gcc (using cygwin/MSYS in Windows). If I declare an array at the beginning of main as: unsigned int arr[1000][1000] there's no problem, but even something as small (8 MB) as unsigned int arr[1000][2000] will fail. This is...
  36. R

    Comparison(Phased arrays) your point of view required

    Hi friends I need some very accurate and practical comparisons of Dipole constituted phased arrays OVER Loop antenna ,Folded Dipole Antenna constituted phased arrays. we normally use half wave dipole antenna arrays...why don't other not much in practice?? Plz reply...
  37. D

    Crops for Ethanol versus Solar Arrays

    There has been much talk in the U.S. about growing corn and switch grass for the production of ethanol. The purpose being to use ethanol as a fuel additive. Would it not be possible to produce more energy by putting solar arrays in place of these crops? It would seem that ethanol...
  38. M

    Comp Sci C++ Help: 2-D Arrays Homework

    Homework Statement 1. Create a 2D array, A[10][10], of 100 integers. 2. Ask the user for two integers R and C where 0 < R ( 10 and 0 < C ( 10. 3. Using nested loops, fill every element A[i][j] (where 0 ( i < R and 0 ( j < C) with random numbers ranging in [0, 200]. I will describe how to...
  39. H

    Maple Plotting arrays of values in Maple

    I'm tring to plot a nuclear decay curve in Maple. I need to calculate the activity at regular time intervals which I'm doing by using a repetition statement to create an array something like: > for time from 1 by interval to 600 do... etc. It's working the arrays out fine, but when I...
  40. J

    Fortran Arrays with parameter and data statements in fortran 77

    Let's say you have an array A and a variable B (both reals). Apparently parameter (A = (/1.2, 3.4, .../) ) is illegal, so you have to do data A /1.2, 3.4, .../ instead. However, what if you have a statement afterwards like this? 1 parameter (A = (/1.2, 3.4, .../) ) ... 2...
  41. I

    Could Capacitor Arrays in Space Harvest Free Electrons from the Sun's Corona?

    Could Capacitor Arrays in Space be used to collect free Electrons in mean free orbit? If so, Could using Capacitors with open Space Dielectric constants between Plates be sufficient for building a Capacitor Space Array? all plates exposed to open Space and no casing.:bugeye: If you...
  42. K

    Sorting 1 file into 3 Arrays

    The Problem (from the handout, word for word): Write a program that reads a list of integers from the file "numbers.in" into an array, which I will call numbers. Then sort the numbers into 3 groups, a group of odd numbers, a group of even numbers, and a group of negative numbers, use an array...
  43. C

    Could use some, no, a LOT of help on my arrays assignment (C)

    Here's the project sheet. it's due tomorrow btw "Write a program to input, compute, and display various statistics for a list of test scores of up to 30 positive test scores of type double. You shall input an array with the following values as one of your test cases (use -1 as a sentinel...
  44. D

    Creating a Uniform Magnetic Field Using Halbach Arrays

    Hi, I have recently stumbled across Halbach arrays while searching for ideas on creating a uniform magnetic field. The suggested configuration for the halbach array can be seen here: http://www.matchrockets.com/ether/halbach.html (First diagram at the top of the page, Magnetic flux of a...
  45. N

    C/C++ Does 'delete [] varname;' delete multiple arrays in C++?

    Was wondering if the "delete [] varname;" deletes multiple arrays eg... I coded a 3-D array as follows: type ***name; name = new type**[n]; for i: name[i]= new type*[n]; for i,j: name[i][j]=new type[n]; and name[i][j][k] is and element in the array now does "delete [] varname;"...
  46. B

    Java Selection Sorting Arrays in Java

    So, I have to create a program that makes a new array with 20 slots, then it asks you to enter a value into each index, which I have here: import java.io.*; class ArrayLoop { public static void main (String[] args) throws IOException { int[] array = new int[20]; for (int i...
  47. C

    Java Checking if One Array is Contained in Another using Java Arrays

    Hello all I am trying to write a program that checks whether one array is contained in another array. For example, A = {1,2,3} B= {1,2,3,4,5,6} A is contained in B, so we print out true, otherwise we print out false. Any advice or tips in writing this program would be greatly...
  48. J

    Three-Way Arrays: Algebra Basics Explained

    Can some describe to me the basic algebra of three-way arrays?
  49. Math Is Hard

    Passing pointers and arrays to a C function

    This is the latest assignment I am struggling with: Write a program that contains a function void shift(char *) that looks at the first character of its argument and converts the other characters, to be the same case, that is, if the first character is uppercase, it shifts the rest to...
Back
Top