Search:

Type: Posts; User: Olchi

Search: Search took 0.01 seconds.

  1. Replies
    1
    Views
    3,033

    Valgrind error Olympic Medals

    #include"projekti.h"
    #include<string.h>
    #include<stdlib.h>
    #include<stdio.h>

    struct country *add_country(struct country *array, char *name)
    {

    int i;
    for (i = 0; array.name != NULL;...
  2. Replies
    3
    Views
    6,678

    Thank you guys, it helped with my other memory...

    Thank you guys, it helped with my other memory issue, but not with the problem I initially had, however I managed to figure it out by looking upat how writing file with structs actually works!
  3. Replies
    3
    Views
    6,678

    Write File to struct

    void printtable(struct country *array)
    {
    for (int i = 0; array.name != NULL; i++) { //Moving through the array of structs until NULL character.
    printf("%s %d %d %d\n", array.name,...
  4. Replies
    2
    Views
    3,693

    Thank you so much!!!!

    Thank you so much!!!!
  5. Replies
    2
    Views
    3,693

    Help with assignment (Olympic medals)

    country *add_country(struct country *array, char *name)
    {

    int i;
    for (i = 0; array.name != NULL; i++);
    struct country *newcountry = realloc(array, sizeof(struct country) * (i + 2));
    if...
Results 1 to 5 of 5