arrays

How to make an unboxed array of floats I can get a Ptr to

I am trying to do some work with HopenGL and I need a Ptr that points to a array of floats. From what I have read uarray and storableArray seem to be the way to go, in some combination some way. ...

[2D Array in C] How to write a program that use 2D array to generate a matrix?

Suppose user enter a integer "3", the matrix should 3 X 3 and some random numbers in it. For example: 8 0 2 6 3 4 5 7 1 I need to use 2D array to do it. But I have no idea about how to finish it. Here is my code, what should I do now? #include "stdafx.h" #include "stdlib.h" #include "time.h" int _tmain(int argc, _TCHAR* argv[])...

In Perl, how can I find the index of a given value in an array?

$VAR1 = [ '830974', '722065', '722046', '716963' ]; How can I calculate the array index for the value "722065"? ...

PHP - count my quantity item in session array

How to count the item-qty and current code :- $q = $_POST['item-qty']; $i = count($q); $k = 0; while ($k < $i) { $select = 'SELECT * FROM location'; $query = $db->rq($select); $price = $db->fetch($query); if ($_POST['item-qty'][$k] < 3) { $get = $price['normal_price']; $price = $get * $_POST['item-qty'][$k]; ...

C# -- Create Managed Array from Pointer

Dear Sirs, I'm trying to create a Managed Array of doubles from an array of bytes. I have the problem working currently, but I wanted to optimize. Here's some code that I would like to work: private unsafe static double[] _Get_Doubles(byte[] _raw_data) { double[] ret; fixed (byte* _pd = _raw_data) { double* _pret =...

Actionscript 3: Array Scope in a Document Class

I have the following function to set up cards in a game. I created one array to hold the kind of cards, and another array to hold the position of the cards. private function setPlayerCard(cardNumber:int, cardPos:int):void{ for (var i:int = 1; i < _CardGridInstance.numChildren+1; i++) { var _position:MovieClip = MovieClip(_C...

C. Segmentation Fault when function modifies dynamically allocated 2d array

What i need is a function that modifies given pointer to 2d matrix like this: void intMatrixAll(int row, int col, int **matrix); Now, a function should allocate memory and the matrix could be used. Rows and cols are given at run-time. #include <stdio.h> #include <stdlib.h> #define PRINTINT(X) printf("%d\n", X); void intMatrixAll(in...

How to create an multidimensional array in VB.NET or PHP

I have a data set that is setup for comments. I have levels and a sort column but now I would like to either get this in an array or display it somehow in a meaningful way: id comment Parentid Level sortcol 2 Test NULL 0 0x00000002 4 This is the Second NULL 0 0x00000004 5 First Reply ...

What is the proper way to handle module level arrays in a VBA class?

What is the proper way to handle a module level array in a VBA class? I use Property Let and Property Get for other variables, but I haven't figured out how to pass arrays to and from Properties. Updated. This code works thanks to Mark Nold. Option Explicit Private mstrTestArray() As String Public Property Get TestArray() As String(...

how to transform a string to an array with # as a delimiter but only the first one?

(only the first # is a delimiter) 50#some message from me to you #1 or #2 into array ( [amount] => 50 [message] => 'some message from me to you #1 or #2' ) ...

Get all elements in array besides the first one.. ? (php)

Is there a way to specify getting all but the first element in an array? I generally use foreach() to loop through my arrays. say array(1,2,3,4,5), i would only want 2, 3, 4 ,5 to show and for it to skip 1. ...

ArrayIndexOutOfBoundsException in xerces parsing

I do not know where the problem is... Help and Thanks! Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 8192 at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:543) at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1742) at com.sun.org.apache.xerces....

assigning values to an integer array within a Fortran module

hi, I have a module in Fortran called QFoo. It defines a type QFooType. I want to initialize all the elements of integer array 'is_n' to 0 and want to do it within the module. Could someone help? Thank you! module QFoo type QFooType integer::i integer, dimension(50) :: is_n ...

Java: ArrayList of String Arrays...

I would like to do something like this: private ArrayList<String[]> addresses = new ArrayList<String[3]>(); ...this does not seem to work. Whats the easiest way of storing multiple addresses with 3 fields per address in an array without creating a separate class for it? ...

Get first element of array

Hi ! I have an array: array( 4 => 'apple', 7 => 'orange', 13 => 'plum' ) I would like to get first element of this array. Expected result: string apple One requirement: it cannot be done with passing by reference, so array_shift is not good solution. Any ideas ? ...

How to copy List to Array

Hi I have list of Guid's List<Guid> MyList; I need to copy its contents to Array Guid[] Please recommend me a pretty solution ...

How does $#array work in Perl?

In the following example: my $info = 'NARIKANRU'; my @first_one = split /,/, $info; print "$first_one[$#first_one]$first_one[$#first_one-1]\n"; The output is: NARIKANRUNARIKANRU I am not sure if this is correct because there is only one element in @first_one and $#first_one is the index of that element. Given that $#first_one is ...

[C Program] How to generate a new random number and transpose the matrix?

Thanks for all helped me before. But I still have some questions about the program. How to generate a new random number while the new random number is equal to the previous random number? Also how to transpose the matrix? #include "stdafx.h" #include "stdlib.h" #include "time.h" int _tmain(int argc, _TCHAR* argv[]) { int nu...

How to convert nested List into multidimensional array?

In Java I want to convert a nested List which contains at the deepest level a uniform type into an multidimensional array of that type. For example, ArrayList<ArrayList<ArrayList<ArrayList<String>>>> into String[][][][]. I've tried several things and I only can obtain an array of objects like Object[][][][]. For 'simple lists' it seems ...

PHP - foreach how to store the array to mysql

I want to store array into mysql db something like this item_row = nike,adidas,puma qty_row = 1,3,2 total_row = 100,200,150 foreach foreach ($_SESSION['order'] as $values) { $item_name = $values['item-name']; $item_qty = $values['item-qty']; $item_price = $values['item-price']; } Let me know how to do that?...