Questions tagged [static-array]
56 questions
0
votes
1 answer
How can I return Java arrays from C++ using SWIG?
I want to create a function which will return a static array and wrap this function with SWIG to be able to use it in Java.
Say I created my own class and I have a C++ function which looks like
myClass* myFunction()
{
// stuff here
}
And I want…

Rivten
- 43
- 1
- 4
0
votes
2 answers
Is passing a static array to a function efficient?
#define BUFF_SIZE 100000
unsigned char buffer[BUFF_SIZE];
void myfunc(unsigned char[],int,int);
void myfuncinfunc(unsigned char[],int,int);
int main()
{
int a = 10, b = 10;
myfunc(buffer,a,b);
}
void myfunc(unsigned char array[],int a,int…

Rakshit Kothari
- 399
- 1
- 5
- 16
0
votes
2 answers
Double Static Array Throws Exception
I am working on an game assignment for my class in eclipse. I have been getting an error:
ClassNotFoundException(throwable);
It stops in
public static Jewel[][] grid = new Jewel[8][8];
While running the debugger it doesnt seem to enter the new…

Kraczekj
- 1
- 3
0
votes
3 answers
sizeof static array member returns the size of the pointer and not the array
So I have a C++ struct, which has a static array as a member, and I want to ask for it's size in the constructor. As I understood from this article http://msdn.microsoft.com/en-us/library/4s7x1k91(VS.71).aspx, sizeof can be applied to a static…

xaviersjs
- 1,579
- 1
- 15
- 25
0
votes
1 answer
CUDA cudaMalloc failed after running kernel with huge static arrays
I have a kernel which uses about 2GB local memory. My cudaMalloc which tries to alloc 2.5GB memory fails if I run that kernel_func before.
I found out that 2GB memory is still occupied after finished running kernel_func, which leaves only 1.5GB for…

Jeanno
- 782
- 1
- 8
- 17
0
votes
2 answers
Is it possible to specify a variable as size specifier for a statically allocated integer array?
I'm surprised that this code compiles and works perfectly without throwing any errors!
int arraysize = 1000;
int array[arraysize];
for(int i=0; i

Muru
- 93
- 1
- 1
- 7
0
votes
1 answer
Subscripting a pointers interchangeably with a 2D array in Objective-C?
I have a statically declared array like this Cell SMatrix_A[36][10]. When I use SMatrix_A directly in my code (Cell foo = SMatrix_A[12][8]), everything works fine. However, what I really want is to declare several of these matrices (SMatrix_A,…

kbyrd
- 3,321
- 27
- 41
0
votes
1 answer
Creating a char array, whose size is given by parameter - C++
I have a class with a static char array.
The size of the array is given to me in argv.
I want to do somthing like this:
class ABC {
public:
static char *buffer;
ABC(int size) {
ABC::buffer = new char[size];
}
}
// in other file:
ABC…

kakush
- 3,334
- 14
- 47
- 68
0
votes
2 answers
How can I place a pre set array of a struct in a different struct?
I'm going through something that should be simple in C but for some reason cant seem to get it to work.
Here are the structs:
#define MAX_BRANCH 500
#define MAX_BANK_CLIENTS 100000
#define MAX_CLIENTS 10000
typedef struct Client{
…

lddmonster
- 63
- 11
-4
votes
2 answers
Printing only unique elements in an array
Edit: I need to maintain the order in which the elements are present in the original array, so sorting won't work.
I have a 1-D array containing some elements and I am using printf() in C but I only want to print an element if and only if it has not…

Anibha
- 7
- 2
-5
votes
2 answers
Creating a JavaScript global array with static elements?
Creating a JavaScript global array with static elements?

aadu
- 3,196
- 9
- 39
- 62