HowTo convert C struct with array of another struct in java

Status
Not open for further replies.

kb

Broken In
How to convert C code(given below) in java

C code:
struct structA {
int varA[4];
float varB[2];
}

struct structB {
int len;
structA varC[50];
}

void main {
structB varD[10];
.....
.....
somefunction(varD) {
.....
}
}

Here i have a structure A with variables of different data types(some are array)

And also i have a structure B with some variables (one of the variable is of data type of structure A [mind u this is an ARRAY])

In the C code im using array of structure B
And initialising the values of the variable of structure A, obviiously using the dot operator

This works perfectly in C.

In java i used class insted of structure, i thought it would work
But it gives error while initialising values of the variable of structure A( that is class A).
 

icecoolz

Cyborg Agent
Actually you dont need to use classes. Use collections Instead. Collections can be anything. Objects, Arrays and so on. Can you copy paste the code that you wrote ? Perhaps we can work it from there
 
Status
Not open for further replies.
Top Bottom