Questions tagged [static-array]
56 questions
1
vote
2 answers
C Preproccessor Pointer Swizzling
I'm trying to avoid a problem in a static table whereby one table references another which references the original table. The compiler complains about the definition of one of the table members not being found. To work around the problem, I've been…

Brian
- 145
- 1
- 3
- 13
1
vote
0 answers
Static arrays are always filled with zeroes in BroadcastReceiver
I would like to get values from some static Array inside BroadcastReceiver. The problem is that it is always filled with zeroes inside BroadcastReceiver, while it is not anywhere else in the application. Inside MainActivity I created a testArray…

fragon
- 3,391
- 10
- 39
- 76
1
vote
1 answer
Can I write a function that takes a static array of chars in D?
for example, i want to write a function with this signature: int foo(char[]) and to call it using char[5] x; foo(x).
At the moment i get a compile error stating that char[] isn't the same as char[5].
I thought of writing: int foo(uint…

ordahan
- 187
- 9
1
vote
1 answer
PHP - class intern static registry array(&$this) not working
Greetings dear Community,
I am trying to write a class which keeps track of all instances internally via a static array of references to each object:
# MyObject.php
class MyObject{
public static $_register = array();
public $_id = -1;
…

user3297674
- 11
- 1
1
vote
2 answers
C Preprocessor – exploding an array and its length
I have a question. In my own webserver I have the following code at the file scope:
typedef struct {
char *slice;
int length;
} values_index;
const char *aHeaderKeys[] = {
/* You can add here whatever you want! */
"Accept",
…

grufo
- 51
- 6
1
vote
5 answers
java null pointer exception with static array
I got a null pointer exception when accessing a static array from a static member method.
The exception is thrown when i call setData(x, y, z) from a thread. When I debugged it I found out data[0] is null when i try to write to it. I just don't…

user2950911
- 873
- 3
- 12
- 19
1
vote
1 answer
Adding new items to a static array
I am very new to coding and have been asked to do the following:
Create two static arrays that will hold the gross and net income. A user will input the gross income every month and the net must be calculated and saved.
Now what iv have so far is…

toddler dev
- 21
- 2
- 8
1
vote
2 answers
is iPhone autorelease working for c arrays?
will autorelease release my non-object c array?
I am wondering, because perhaps only objects know their reference count?
here's my code:
-(int *)getCombination{
int xIndex = arc4random() % [self._num1 count] + 1;
int yIndex = arc4random() %…
user1545072
1
vote
1 answer
Delphi static array thread safety only with critical section
I have a Win32 Thread (no TThread) that runs alle the time and iterates over a static array. The mainthread can modify fields of the array. What is the best way to make this thread-safe without components like TThreadList (for a no-vcl application),…

tim93
- 109
- 2
- 7
0
votes
2 answers
A better way to initialize a static array member of a class in C++ ( const would be preferred though )
I have a static array of pointers to functions as a member of a class.
I need to initialize it, but it turns out this array is 64K items long, so it's impractical to initialize it with a static initializer like { x, y, z, ... } as it would clutter…

Petruza
- 11,744
- 25
- 84
- 136
0
votes
2 answers
Create static array using Class.forName
In Android there is a undeclared (hidden) class named "android.graphics.FontFamily" and I want to create static array of it. Any thing like this:
Class> clazz = Class.forName("android.graphics.FontFamily"); // Ok.
Class> clazz_array =…

mh taqia
- 3,506
- 1
- 24
- 35
0
votes
2 answers
Remove duplicate array elements
I need to remove all duplicate values from an array of integer, yet maintain the order of the elements:
Example:
10,20,20(duplicate),10(duplicate),50
Becomes:
10,20,50

Alca
- 81
- 2
- 13
0
votes
0 answers
c++ static array sizeof()
Here is some code:
int static_array[10];
cout<<"sizeof(static_array): " <

Botond
- 2,640
- 6
- 28
- 44
0
votes
1 answer
fwriting a doubly linked list to a binary file segmentation faults
this is my student struct with the information I read in via binary
typedef struct student_t {
//data in here
} student_t;
this is how I have declared them in main
double_linkedlist_t* listPtr;
student_t students;
node_t* node =…

CodeHero
- 23
- 9
0
votes
3 answers
Static arrays with variable length
Is the following legal?
const int n=10;
static int array[n];
If, yes, then why and how?

chanzerre
- 2,409
- 5
- 20
- 28