struct person{
char name[20][30];
int age[20];
};
I'm passing the pointer *h to the function and I want the read data to be stored in the structure. I've done typedef...
Type: Posts; User: Etdim
struct person{
char name[20][30];
int age[20];
};
I'm passing the pointer *h to the function and I want the read data to be stored in the structure. I've done typedef...
I have a problem assigning value to a variable that is in a structure.
I think that's the row with the problem:
fscanf(fp, "%s %d\n", h->name[c_names], h->age[c_names]);
Is this the rights...
Ok, now I understand. But what about errors like
test.c(147) : error C2143: syntax error : missing ';' before 'type'
test.c(116) : warning C4047: 'function' : 'struct _iobuf *' differs in levels...
matsp, is there any way to tell the MSVC 6.0 compiler to compile with "-ansi" - as I understood that's causing the errors.
Surrounding with braces, as you said, works - the error in line 167 is...
if(num_people == 0){
printf("No people records.");
return 0;
}
int i,j,k,count; // this is test.c (167) error C2143: syntax error :...
laserlight, do you think it might be something with the encoding of the file?
Here are examples.
The code:
for(k = 0; k <= num_people; k++)
gives error
Thank you, I did it with bubble sorting, it's working fine. :)
Hello. I get errors trying to compile C source written and working in DevC++. When I paste it in Visual Studio 6.0 it shows strange errors and won't compile. Can you help me with this?
Now I have another problem. I'm unable to sort the names+ages alphabetically. I display them correctly, but I cannot find a suitable way to sort the 2d string array and display it (just display it...
dwks, I appreciate your help very much. Thank you.
I added a struct to keep the names and age, so I can easily display them after that.
Tomorrow I'll try to make it read the data from a binary...
Ok, so I made
int ages[50];
int c = 0;
and in the for loop
ages[c] = age;
After that, when I printf age it is ok, I use another for loop and it prints all the ages.
dwks, thank you very much! It works perfectly! That's exactly how it should work. :)
Can you help me just e little bit? I know how to store the age in an array and how to sort it and so on, but...
dwks, your code gave me strange result. Age was at the place of Name and for Age there were quite big numbers - like 2101215 and so.
Brad0407, I'm trying currently to use your suggestion for...
Thanks for your replies, guys. But can you give me help about how to store the string I've split and post-split it? That's what I can't find out. I'm not so good at C, so I don't know what's the best...
Hello. I have a problem trying to split and store specific string.
When user enters: Name1 10, Name 2 15, Name 3 40 I have to split it and store Names and age for other actions - like name sorting....