#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;...
Type: Posts; User: Olchi
#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;...
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!
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,...
Thank you so much!!!!
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...