On Sun, Nov 23, 2008 at 2:10 PM, Brett McCoy <[EMAIL PROTECTED]> wrote:
> On Sun, Nov 23, 2008 at 4:48 AM, Ahmed Shabana <[EMAIL PROTECTED]>
> wrote:
>> #include<stdio.h>
>> #include<string.h>
>>
>>
>> struct sub {
>> char name[100];
>> };
>>
>>
>> struct maiN {
>> struct sub *s1;
>> int c;
>> };
>
> sub *s1 is a pointer inside maiN
>
>>
>> int main()
>> {
>>
>> struct maiN s0;
>> strcpy(s0.s1->name,"hi man ");
>
> You create an instance of maiN but s1 has not been initialized (need
> to allocate memory for it). You try to write data into s1 but you're
> not allowed to yet.

I tried to type struct sub s1 inside the main and outside the main and
they gave me the same result

Reply via email to