--- In [email protected], "John Matthews" <[EMAIL PROTECTED]> wrote:
>
> --- In [email protected], "Ahmed Shabana" <UnlimitedEng@> wrote:
> >
> > okay what is the solution of this problem ???????/
> > HOW can I assign the variable which called "name"
>
> Example:
>
> int main()
> {
> struct sub sub0;
> struct maiN s0;
>
> s0.s1 = &sub0;
> s0.c = 42;
>
> strcpy(s0.s1->name,"hi man ");
> printf("name: %s\nvalue: %d\n", s0.s1->name, s0.c);
>
> return 0;
> }
...or alternatively use dynamic memory allocation:
#include <malloc.h>
int main(void)
{
struct maiN s0;
s0.s1 = malloc(sizeof *s0.s1); /* should check not NULL */
s0.c = 42;
etc.