
www.Usenet.com
| <-- __Chronological__ --> | <-- __Thread__ --> |
[EMAIL PROTECTED] (Yang Xiao) writes:
> hi all,
> why doesn't this compile using lcc-win on W2K?
>
> #include <stdio.h>
>
> int main(void)
> {
> typedef struct {int age; char *name;} people;
> people *person;
> person->age = 10;
> person->name="Ricky";
> return 0;
Well what do you think is *person? It's an unintialized
pointer. Provide the proper amount of memory for it and it will work,
and than use the proper things to copy things person->name= will not
do what you like it to do.
Regards
Friedrich
| <-- __Chronological__ --> | <-- __Thread__ --> |