I want to read a number, 4 names (store them in a [N][100] array) and one number string from stdin. The problem is that the last name has space in it "Mc Millan" and i can't get the string whole with...
Type: Posts; User: Grigoris Savvas
I want to read a number, 4 names (store them in a [N][100] array) and one number string from stdin. The problem is that the last name has space in it "Mc Millan" and i can't get the string whole with...
Thank a lot Tim. I changed the char c to char c[2] and stored the character in c[1], passing c to atoi. The problem is fixed and all the nodes were loaded correctly. Maybe i should give the tihngs as...
Yes i know that atoi is for char *. The argument of atoi expects a pointer to a string. But if I use the & is like passing a just the first element of an array, which is not an array but a single...
I posted them for size 10.
Thanks that was an error i hadn't notice. But my main problem is not solved yet and i don't think it is a logical neither a syntax error, because the process is the same for all the nodes of the...
The telephone numbers are int[10].
Maybe is the OS that screws up the nodes. Something wrong with pointers and access. I thought that may would work in other OS but i don't have the comort to try...
I am making a program in C, that creates 2 files for 10 students. First one contains an int id, a char name[10], a char surname[10] and an int year in which a student got into school in each line....
I am trying to make a randomized quicksort. I have try a lot of quicksorts varieties to see if i can work on others but still i cannot make it to run properly. My quicksort sorts an array of structs...
Thanks a lot. I fully understand the realloc function and the mistakes of my codes. I will do some more research on casting to undrestand it more. Thanks again!
Yes that's true. My compiler is a C++ one. I thought realloc copies the previous block of memory to a new one and allocates extra memory equals to the size you give. In my situation i used realloc...
I tried to compile it without the casting at malloc but i got this error: invalid conversion from `void*' to `Student*'
My problem seemed to be the allocation of realloc. The * (st.size + 1).
So...
Well, I Have 1 struct called Student and 2 called Students. Struct Students has an Array of structs Student. When i pass the second struct after giving the id, name and surname, the program crushes....