I have the following function
void initBoard(int * board[BOARD_ROWS][BOARD_COLS]){
int z = 0;
for( z = 0; z<10; z+=1){
int l;
for( l = 0; l<10; l+=1){
board[z][l] = 0;
}
}
}
and from main i call it like
int plBoard[10][10];
initBoard(&pcBoard);
when compiling it works but i get a warning saying: war...
I am working with C style 2d arrays of integers.
This is fine in my main class file, and I can pass my arrays by reference to other classes. I have run into issues when I try to retrieve a pointer to the arrays and work with that.
My question is: rather than using C style 2d arrays, is there a better way to do it? maybe a Cocoa class I...
On pg. 109 of K&R, we see:
void writelines(char *lineptr[], int nlines)
{
while (nlines -- > 0) printf("%s\n", *lineptr++);
}
I'm confused about what *lineptr++ does exactly. From my understanding, printf requires a char pointer, so we provide that with *lineptr. Then we increment lineptr up to the next char pointer in the array? Is...
I made an anagram machine and I have an array of positive matches. The trouble is they are all in a different order, I want to be able to sort the array so the longest array values appear first.
Anybody have any ideas on how to do this?
...
Is it possible to create an array of stacks without having to cast the stacks as they come out?
Eclipse gives me a warning about not being able to make a generic array of Stack when I do something like this:
Stack<Card>[] cards = new Stack<Card>[52];
...
What's the advantage of using malloc (besides the NULL return on failure) over static arrays? The following program will eat up all my ram and start filling swap only if the loops are uncommented. It does not crash.
...
#include
unsigned int bigint[ 1 << 29 - 1 ];
unsigned char bigchar[ 1 << 31 - 1 ];
int main (int argc, char **argv)...
I'm having a bit of a problem using FieldOffset correctly with arrays. The code below is an example where it doesn't work correctly for me:
[StructLayout(LayoutKind.Explicit)]
public struct IndexStruct {
[FieldOffset(0)]
public byte[] data;
[FieldOffset(0)]
public short[] idx16;
[FieldOffset(0)]
public int[] idx32;
}
If I for ...
I need to check a javascript array to see if there are any duplicate values. What's the easiest way to do this? I just need to find what the duplicated values are - I don't actually need their indexes or how many times they are duplicated.
I know I can loop through the array and check all the other values for a match, but it seems like ...
Hi,
I need to transform my nested sets structure (mysql) into json for this spacetree
1) http://blog.thejit.org/wp-content/jit-1.0a/examples/spacetree.html
I found this function to create an array from nested sets:
2) http://semlabs.co.uk/journal/converting-nested-set-model-data-in-to-multi-dimensional-arrays-in-php
I can also convert...
I have a drupal function that contains an array. I want to redefine one of the variables in that array. Do I just copy paste that entire function into template.php and change the variable to what I want it to be? Thanks.
...
I have an array:
$arr_nav = array( array( "id" => "apple",
"url" => "apple.html",
"name" => "My Apple"
),
array( "id" => "orange",
"url" => "orange/oranges.html",
"name" => "View All Oranges",
),
array( "id" => "pear",
"url" => "pear.html",
"name" => "A Pear"
)
);...
In PHP I would like to get the text value of the customer name tag. I write this code but this does not work. Would you please help me with this? Thank you
$customerName = $dom->get_elements_by_tagname("item");
$customernameValue = customerName[0]-> first_child()->node_value ();
...
I would like to initialize an array of structs, with the same element repetitively, ie
struct st ar[] = { {1,2}, {1,2}, {1,2} };
However I do NOT want to run any code for that, I wish that the layout of the memory upon program's execution would be like so, without any CPU instructions involved (it would increase boot time on very slow...
I'm trying to convert some code from C# to C so that it can be burnt onto a microcontroller.
Could someone please tell me how I would convert a two dimensional string array in C# into something in C?
My C# code looks like this:
string[,] DirectionPosition = {{"00", "10", "", "01", ""},
{"01", "...
Hi folks,
i have a list of lat/long objects on my server.
eg.
public class LatitudeLongitude
{
public float Latitude;
public float Longitude;
}
simple.
now, can i return a collection of these, in json format .. BUT ... i do not want to list the key, just the values.
This means the normal result would be something like ...
...
Is there any way to return an array from a function? More specifically, I've created this function:
char bin[8];
for(int i = 7; i >= 0; i--)
{
int ascii='a';
if(2^i-ascii >= 0)
{
bin[i]='1';
ascii=2^i-ascii;
}
else
{
bin[i]='0';
}
}
and I need a way to return bin[].
...
Some code for context:
class WordTable
{
public:
WordTable();
~WordTable();
List* GetListByAlphaKey(char key);
void AddListByKey(char key);
bool ListExists(char key);
bool WordExists(string word);
void AddWord(string word);
void IncrementWordOccurances(string word);
void Print();
private:
List *_listArray[33];
int...
Using this very simple function:
Function WriteArray() as Variant
Dim array(0 To 2)
array(0) = "A"
array(1) = "B"
array(2) = "C"
WriteArray = array
End Function
I was expecting to see in result the whole array in my Excel spreadsheet, but that's not the case: I get only the first string. I know there is trick to show the whole ar...
I would like to use the FFTW C library from Delphi 2009 and according to this documentation;
http://www.fftw.org/install/fftw_usage_from_delphi.txt
to increase the performance inside the FFTW library (such that it can use SIMD extensions) arrays passed in of either Single (float) or Double (double) need to be aligned either at 4 or 8 b...
Lets say I have an array which has n dimensions. Now in order to access a slot you typically use:
array [1][0]
What if the number of dimensions are not known at compile-time, is there an easy access like:
slot = "1,0"
array [slot] // accessing 1,0
Which means I can also easily navigate back and forth
slot += ",2"
array [slo...