Whats wrong with this?I am getting segmentation fault during runtime.
int size;
scanf("%d",&size);
int init[size][size];
//initial matrix
for(int i=0;i<size;i++)
for(int j=0;j<size;j++)
scanf("%d",init[i][j]);
...
I want to do a simple dynamic array of ints in my j2me application,
The only dynamic array I see is "java.util.Vector" and this one doesn't seem to accept an int as a new element (only wants Objects).
So how do I go around fixing that problem?
...
Guess I have just never run across it before.
What is the proper way to turn a char[] into a string?
The ToString() method from an array of chars doesn't do the trick. Guess I had always imagined that was what it was for.
...
I prefer to program my bash scripts to be as procedural as possible. One difficulty I've encountered in trying to do so happens when passing array data between functions, a task that's not well supported in bash.
As an example, it's trivial to initial an array in bash with multiple hard-coded, quoted values, each of which may contain m...
Possible Duplicate:
PHP Arrays: A good way to check if an array is associative or sequential?
What would be the most performant way of checking if an array is associative or not in PHP?
...
I have two arrays :
string[] Group = { "A", null, "B", null, "C", null };
string[] combination = { "C#", "Java", null, "C++", null };
i wish to return all possible combinations like
{ {"A","C#"} , {"A","Java"} , {"A",C++"},{"B","C#"},............ }
(null should be ignored).
using LINQ.
Help please.
...
Given the following program
#include <iostream>
using namespace std;
void foo( char a[100] )
{
cout << "foo() " << sizeof( a ) << endl;
}
int main()
{
char bar[100] = { 0 };
cout << "main() " << sizeof( bar ) << endl;
foo( bar );
return 0;
}
outputs
main() 100
foo() 4
The questions:
Why is the array passed as a point...
Hi friends,
I'm researching hours and hours, but I could not find any clear, efficient way to make it :/
I have a codeigniter base website in English and I have to add a Polish language now. What is the best way to make my site in 2 language depending visitor selection?
is there any way to create array files for each language and call...
I would like to retrieve the first key from this multi-dimensional array.
Array
(
[User] => Array
(
[id] => 2
[firstname] => first
[lastname] => last
[phone] => 123-1456
[email] =>
[website] =>
[group_id] => 1
[company_id] => 1
...
Did I say "array" enough for you there? To clarify:
I'm working on organizing and array in an iPhone project.
I have an array of arrays. Each sub array has a list of items.
How can I make a new array of all the items contained in the sub arrays?
I've experimented with the addObjectsFromArray function with little luck.
Thanks!
...
The PHP array type is actually more akin to an an ordered map than a traditional C array. It's PHP's original general use data structure. The manual goes as far to say The indexed and associative array types are the same type in PHP, which can both contain integer and string indices.
However, there's a lot of cases where built-in lang...
https://developer.mozilla.org/en/New_in_JavaScript_1.7
A lot of these new features are borrowed from Python, and would allow the creation of less verbose apps, which is always a good thing. How many times have you typed
for (i = 0; i < arr.length; i++) {
/* ... */
}
for really simple operations? Wouldn't this be easier:
[/* ... ...
So I have a class foo that has a method which returns an array bar. I have another function that calls foo.getBar and then filters the array. I want to be able to always get the original contents of bar when I use a different filter, but bing seems to be just creating a reference to bar, not a separate array. I have tried using return th...
Is there any function available in PHP to check whether an array is empty or how can I do this without using loop?
For example: $b = array('key1' => '', 'key2' => '', 'key3' => '', 'key4' => '');
How can I check array $b contains empty values without using a loop?
...
Hi,
I have an Extension Method:
public static string ToDelimenatedString(this object[] array, string delaminator) {...}
The Extension is applied to reference types but not value types. I assume this is because object is nullable. How would I write the method above to target value types, is it even possible without writing it out for ...
As a follow up to my question about j2me dynamic arrays,
I'm now trying to figure out a way to change the values of the Integers in my Vector.
Say I have a Vector v, and Array arr, and ints x, y and i;
In c++ I could do:
v[arr[x][y]] += i;
In j2me the best way I found so far to do the same is:
v.setElementAt(new Integer(((Integer)...
Very much related to my previous question, but I found this to be a separate issue and am unable to find a solid answer to this.
Is the memory used by a (character) array freed by going out of scope?
An example:
void method1()
{
char str[10];
// manipulate str
}
So after the method1 call, is the memory used by str (10 bytes) fre...
Hi,
I know that similar questions are posted in SO, but I thought I can ask this in the following the context:
char amessage[] = "now is the time";
char *pmessage = "now is the time";
I read from The C Programming Language, 2nd Edition that the above two statements don't do the same thing.
I always thought that an array is an conven...
(edited to fit the answer)
Looking the "Array" section in the bash(1) man page, I didn't find a way to slice a bash array.
So I came up with this overly complicated function:
#!/bin/bash
# @brief: slice a bash array
# @arg1: output-name
# @arg2: input-name
# @args: seq args
# ----------------------------------------------
function...
I have an object with 2 ArrayList properties.
public class TestDTO
{
public ArrayList Test1 { get; set; }
public ArrayList Test2 { get; set; }
}
I am returning the the object as JSON in my JsonResult Action. The SUCCESS from my AJAX call looks like the following but it does not appear to be working. What do I need to do to a...