Hello,
I have a h- and a cpp-file with some calculations used in many of my projects.
Now I tried to put them in a separate dll, so the files should not be included in every project.
When linking I get a LNK2001 (unresolved symbol) error for a struct, however lib and dll are in the right place.
I use the
#ifdef TOOLS_EXPORTS
#defin...
I am writing a LinkedList in C, the below code represent my Node definition.
typedef struct {
int value;
struct Node* next;
struct Node* prev;
} Node;
I understand (or think that I do) that struct Node not the same as typedef struct Node. Granted my code compiles and runs as it's supposed to, however, I get a lot of warnin...
The struct looks like this:
template <class Node_entry>
Node<Node_entry>::Node(Node_entry item, Node *add_on)
{
entry = item;
next = add_on;
}
And the *new_rear pointer does not get initialized, but &item is filled with user input.
Error_code Extended_queue::append(const Queue_entry &item) {
Node<Queue_entry> *new_...
I have two identical (but differently named) C structures:
typedef struct {
double x;
double y;
double z;
} CMAcceleration;
typedef struct {
double x;
double y;
double z;
} Vector3d;
Now I want to assign a CMAcceleration variable to a Vector3d variable (copying the whole struct). How can I do this?
...
I would like to initilize some elements of an struct and array in C++.
In C you can do:
unsigned char array[30] = {[1] = 4, [20] = 4};
struct mystruct
{ int i;
int j;
}
struct mystruct e = {.j = 2};
But I cannot do it in C++. Is there any way to implement this kind of designated initializers?
...
I have a struct defined as
struct sData{
idx * id;
int * stime;
bool * result;
unsigned int N;
};
Then the code that uses it in
numeric compute(numeric e, sData swabs){
numeric cache=0.0;
int sid=0;
while(sid<swabs.N){
if(swab.result[sid])
cache += log(e);
else cache += log(1.0-e);
sid += 1;
}
retu...
Possible Duplicate:
Difference between a Structure and a Union in C
I could understand what a struct means. But, i am bit confused with the difference between union and struct. Union is like a share of memory. What exactly it means.?
...
In my code I'm passing around some structures by reference, declaring them mutable and using the & symbol. The problem is that in some place the fields are corrupted (happens only in release mode) and I don't know absolutely why.
I have found a fix, using ref keyword instead of the address-of operator. I understand that you can intercha...
I have a struct called Point
typedef struct {
GLfloat x;
GLfloat y;
} Point;
create an array of Points:
Point *sPoints;
for(int i=0 ... // define sPoints
somewhere else, I want to alter variables on those points. Why does this work:
sPoints[100].x+=10;
but this doesn't:
Point pt = sPoints[100];
pt.x +=10;
is there any way...
Possible Duplicate:
Why isn't sizeof for a struct equal to the sum of sizeof of each member?
#include <stdio.h>
int main(){
struct word1{
char a;
int b;
char c;
};
struct word2{
char a;
char b;
int c;
};
printf("%d\t%d\n", sizeof(int), sizeof(char)); //Output : 4 1
printf("%d\t%d\n", sizeof(struct word1), sizeof(st...
I have this struct for people:
(define-struct person
(
first ; a string: first name
last ; a string: last name
sex ; a symbol: 'male, 'female
eyes ; a symbol: 'blue, 'brown', 'green
hair ; a symbol: 'blonde, 'brown, 'black, 'red
mother ; a person: empty if not known
f...
I have a struct with an array as a member, and am trying to set that array using arrow syntax. What I have:
typedef float Foo[3];
typedef struct {
Foo foo;
} Bar;
Bar* f() {
Bar* bar = malloc(sizeof(Bar));
bar->foo = {1.0, 1.0, 1.0};
return bar;
}
gcc says:
error: expected expression before '{' token
on the line bar->foo ...
C# question.
Say I have a customers class that has a bunch of props for storing string only data such as name postal data and phone numbers.
I don't use this entity for ORM as I'm only adding it to some type of collection for use during app life cycle.
Additionally I don't need to add any entity specific methods to it or persist the da...
Hi,
I'm trying to sort a structure I've created via qSort however it seems to be be doing what I expect it to.
This is my compare function
int compare(const void *a, const void *b) {
const INPUT *p1 = a;
const INPUT *p2 = b;
return ((p1->startTime) - (p2->startTime));
}
Where INPUT is my structure and startTime is an int...
I'm still earning my C++ wings; My question is if I have a struct like so:
struct Height
{
int feet;
int inches;
};
And I then have some lines like so:
Height h = {5, 7};
Person p("John Doe", 42, "Blonde", "Blue", h);
I like the initialization of structs via curly braces, but I'd prefer the above be on one line, in an anony...
I created a structure to represent a fixed-point positive number. I want the numbers in both sides of the decimal point to consist 2 bytes.
typedef struct Fixed_t {
unsigned short floor; //left side of the decimal point
unsigned short fraction; //right side of the decimal point
} Fixed;
Now I want to add two fixed point number...
Im sure this is simple but I've looked at it too long and I need an answer soon. I am new to C#. If I put GetCommission()
within the struct I get
error CS0188: The 'this' object cannot be used before all of its fields are assigned to
outside the struct
error CS0038: Cannot access a non-static member of outer type 'Ex5._3.Co...
help needed printing array of pointers to structs
where am i going wrong ? please help
include <stdio.h>
include <stdlib.h>
define HOW_MANY 7
char *names[HOW_MANY]= {"Simon", "Suzie", "Alfred", "Chip", "John", "Tim",
"Harriet"};
int ages[HOW_MANY]= {22, 24, 106, 6, 18, 32, 24};
struct person
{
char *name;
int age;
};
...
I have a large struct in a .mat file. I want to check if a specific field is present in the struct without loading the .mat file. The .mat files are very large and I want to minimize memory use.
Can I do this or must I use the I load it like this? Suppose the .mat file is called "test.mat" with struct s in it:
load('test.mat')
tf = i...
Hi!
I have a struct in a web service in c#. When I use "Selet * from TABLE1"; in a WebMethod I get a fully populated struct. But when I add a WHERE clause, I get null in response. Why is this? I have searched everywhere for a simple explanation but haven't found one.
How can I use a SELECT * FROM TABLE1 WHERE _id=" + id "'"; If I only ...