Quantcast
Channel: Initialize recursive struct type in C properly - Stack Overflow
Viewing full articles (3 articles)
Browse article index
↧

Initialize recursive struct type in C properly

$
0
0

I am new to C programming and I have the following struct:

typedef struct _date {    char d[10], t[5], s[3];    struct _date *next;} *date;

How can I properly create an instance of this?

My solution:

date neuerTermin(char *d, char *t, char *s, date cal) {    struct _date d = {*d, *t, *s, NULL};    date d_ptr = malloc(sizeof *d);    cal->next = d_ptr;    return d;}

But I get an error: warning: initialization makes integer from pointer without a cast

↧

Viewing full articles (3 articles)
Browse article index

Latest Images

Trending Articles



Latest Images