So do I like really need to learn about them ? Isn't there an interesting way to learn about stacks, linked lists, heaps ,etc ? I found it a boring subject.
**While posting this question it showed some warning.Am I not allowed to post such a question ? Admins please clarify and I will delete it :/
Warning :: The question you're asking ...
Hi I am working on a program where I have to initialize a deck of cards. I am using a struct to represent a card. However I'm not filling it correctly as I get a bunch of zero's when I display the deck of cards. I believe my mistake is in this line but I'm not sure:
struct card temp = {"Clubs", value, false};
The code:
void initCard...
I have a C# project in which i use several unmanaged C++ functions.
More so, I also have static IntPtr that I use as parameters for those functions. I know that whenever I use them, I should implement IDisposable in that class and use a destructor to invoke the Dispose method, where I free the used IntPtr, as is said in the MSDN page.
p...
Hi,
i need to help with structures, inheritance and definition.
//define struct
struct tStruct1{
int a;
};
//definition
tStruct1 struct1{1};
and inheritance
struct tStruct2:tStruct1{
int b;
};
How can I define it in declaration line?
tStruct2 struct2{ ????? };
One more question, how can i use inheritance for structures ...
I am trying to modularize a function that used to add values to multiple structures in one call. Now I want to do one value addition per call, but I am not sure how to make a less specific argument reference.
func ( [?] *val )
{
}
...
I have a table of structures and this structures are 2 dimentional table of constants.
can you teach me on how to get the values in the table of constants.
(note following is just example)
typedef struct
{
unsigned char ** Type1;
unsigned char ** Type2;
} Formula;
typedef struct
{
Formula tformula[size];
} table;...
Hi, I'm trying to initialise a structure which ends with an array[0] (here, char iedata[0]) for the actual packet payload. If I try to initialise it inline, like this:
struct some_packet pkt = {
.elem1 = blah, .elem2 = bleh,
.iedata = {
1, 2, 3, 4
}
};
I get a warning from gcc:
warning: (near initialization for ‘pkt.ie...
Hi,
I try to pass a pointer of a structure which is given me as a return value from the function 'bar' to the function 'foo_write'. But I get the error message 'TypeError: must be a ctypes type' for line 'foo = POINTER(temp_foo)'. In the ctypes online help I found that 'ctypes.POINTER' only works with ctypes types. Do you know of anothe...
I have a structure Defined in the Header file for a class i am working in, and i am trying to use the Struct in one of the methods of the class. It looks basically like this:
struct example
{
double a;
int b;
...
};
in the header above my class definition, and then in the cpp file, i have:
void exampleclass::test(){
...
All,
Here is an example on Unions which I find confusing.
struct s1
{
int a;
char b;
union
{
struct
{
char *c;
long d;
}
long e;
}var;
};
Considering that char is 1 byte, int is 2 bytes and long is 4 bytes. What would be the size of the entire struct here ? Will the...
I have to access a POS terminal under ms windows xp. I am using python 2.7.
The crucial function in the DLL I load that does the payment accepts two pointer to structures, but it crashes returning 1 (Communication error) but without further messages.
Please note that when the payment function is called, not all the elements of POSData st...
I am writing a C program. I want a variable that I can access as a char but I can also access the specific bits of. I was thinking I could use a union like this...
typedef union
{
unsigned char status;
bit bits[8];
}DeviceStatus;
but the compiler doesn't like this. Apparently you can't use bits in a structure.
So what can I ...
Hello i want to make a Antivirus Software in DataStructure using C#.So help neended for the Algorithm.
...
I am able to get a Structure populated as a result of a dll-function (as it seems looking into it using
x=buffer(MyData) and then repr(str(buffer(x)))
)
But an error is raised if I try to access the elements of the Structure using .value
I have a VarDefs.h that requires a struct like this:
typedef struct
{
char Var1[8+1];
char...
A lot of those coders, who are succeed contests like TopCoder SRMs, or Google Codejam, etc., get good jobs and salary. But is it really neccesary? I mean, do all code developers should know different algorithms, structures, or all this contests are just wasting of time?
The problem is those contests take much time - to train, to study, t...
Apologies for the appalling title.
I have mocked up this code to mimic an issue I was encountering on a project.
I want to know why the property status does not 'stick'. Stepping through the code I can even see it setting the property!
Is it something to do with Structure being a value type?
Here is the code, it is standalone.
Impor...
I have started reading the Lions Commentary on Unix v6. I came across these snippets, which I have never seen used in the C language. The author does provide some sort of an explanation, but could someone explain to me what is happening here?
params.h :
SW 0177570
......
struct { int integ; };
and this used in unix/prf.c
if(SW->int...
I'm looking into creating a generic BST. Nothing fancy no COTS, but I'm trying to decide the best way to keep track of the type of the void*. Here's the interface for the nodes:
typedef struct
{
void *data;
struct TreeNode *left;
struct TreeNode *right;
} TreeNode;
However, when I write add/remove, I'll need to do compariso...
hi,
In the previous question, i made a big mess there. So i want to give it a new try.
struct emp
{
int salary;
string empid;
};
struct payroll
{
int empid;
int deductions;
};
emp a1,a2, a3;
a1.salary = 9000;
a1.empid = 1;
a2.salary = 1000;
a2.empid = 2;
a3.salary = 9000;
a3.empid = 3;
...
This isnt a homework question. I took data structures at a Community College and now that i am at the university i talked to the teacher about there data structures class. Now, since its really different and the class i took transferred, He gave me one of there assignments and said play with it. We never did any containers, wrappers,temp...