I have the following structure:
struct hashItem {
char userid[8];
char name[30];
struct hashItem *next;
};
In the function below I take a char pointer ... |
I'm having trouble passing a structure array as a parameter of a function
struct Estructure{
int a;
int b;
};
and a funtion
Begining(Estructure &s1[])
{
//modifi the estructure s1
};
and the main would be ... |
I have a struct being passed in as a void* pointer
void *find_queens(void *args) {
I tried to turn this pointer in a usable struct using this
struct queens_arg *data = (struct ...
|
I am having a bit of trouble with this one issue. I have an array that holds 2 structs. I need to pass that array into a thread function and ... |
I have a function which takes a pointer, polynomial to an instance of a struct called POLYNOMIAL. This contains an array of pointers to another struct, called TERM. TERM ... |
i have this struct:
struct Node
{
int *ptr;
int k;
}*d_ptr;
how can i declare an array of Node and pass it to ... |
I have the following structure:
[StructLayout(LayoutKind.Sequential)]
public struct TCurve
{
public int fNumItems; /* Number of TRatePts in fArray ...
|
|
I'm having trouble passing an array of structs to a function in C.
I've created the struct like this in main:
int main()
{
struct Items
{
...
|
|
All right; I solved it. The call to the displayTable function appeared before the actual declaration of the function. Apparently the compiler was making some assumption about the code, and was preventing it from compiling. I added the line: void displayTable(const employee*); before (and outside of) main, and now it compiles without problem. Anybody know exactly what was going on? And ... |
Hello I am having some diffculty with this programming assignement, I created an array of structures and all i want to do is pass all the members to a function to print them out. But im getting errors with this: #include #include struct info2 { char lname[250]; char fname[250]; char mname; char numbers[50]; void printout (struct info2); main () ... |
//Structure Passing example #include #include typedef struct { int w; int h; } card_t; //card_t is declared to be of type struct //prototypes void assign(void); card_t *(card_table)[20]; //card_table is a pointer to an array of card_t structures void assign() { int w=3; card_table[0].w = w; } int main(void) { assign(); int temp = card_table[0].w; printf("%d",temp); return 0; } |
Here I have a C program that is supposed to pass structs that it reads from a .csv file to get the fields for the individual structs. Then it should pass the filled struct into the array. But it's not putting the information in the right slots in the array. I'm pretty new to C. I generally work with C#. So ... |
Sorry for the length DateTime dateTimeFromString(const char *s) { DateTime result; char year[5]; char month[3]; char day[3]; char hour[3]; char min[3]; strncpy(year, s, 4); strncpy(month, s + 4, 2); strncpy(day, s + 6, 2); strncpy(hour, s + 8, 2); strncpy(min, s + 10, 2); year[4] = '0'; month[2] = '0'; day[2] = '0'; hour[2] = '0'; min[2] = '0'; result.tm_year = ... |
I'm having trouble finding where to switch the compile preference ? (I just switched from 2003 to 2008). Here is enough of the code to test build it and get the error. Code: #include #include #include void end_game( char * ); void manual( struct crypt [] , char *, int ); void auto_guess( struct crypt [] , char ... |
... void manual_replace ( struct key *key_list, char *txt_p, int size); <-- prototype ... int main (void) { ... struct key{ char encoded; char decoded; }; struct key key_list[26]; ... manual_replace(key_list, text, text_size); <-- calling the function ... return 0; } void manual_replace ( struct key *key_list, char *txt_p, int size) { printf("%c", key_list[1].encoded); printf ("%c %d", txt_p[0], size); getchar(); return; ... |
Problems with passing an array of structures by pointer Hello everyone. I have looked through other posts and have not found a solution to my problem but if there is another thread with the same problem please reply with the URL. This is a first time post for me. I am having trouble with the function Additem which should take a ... |
|
|
|
I assume that you are using C++ (the use of "new" gave it away). Yes, to pass an array of structs to a function, you would pass a pointer to that array. However, this is simplified by the fact that the name of that array IS ITSELF a pointer; e.g.: Code: struct MyStruct // you can get away with simplified struct ... |
I'm not sure what you're trying to do here, are you messing with us or what? You need three things for a function call: 1) The call - we've got that 2) The function prototype - we've got that 3) The function itself - and we don't have that You have declared pointar and circlear as global arrays of three structs. ... |
|