|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Artur Grabowski (art
blahonga.org)Date: Tue Feb 05 2002 - 20:25:08 CST
Marc Xander Makkes <xander
kr85.org> writes:
> I have this little code;
>
> +----
>
>
> #include <stdio.h>
>
> struct point { int x; int y;};
> int main()
> {
> struct point *p;
> p->y = 13;
> printf("%d\n", p->y);
> }
>
>
> ----+
>
> it compiles and runs ok on solaris, and it compiles ok on openbsd but
> when i run it, it directly core dumpes. Is there something i forgot to
> read or is it the 13?:)
>
> The code is compiled on 2 differend OpenBSD 3.0 machines, one with GENERIC
> and one modified, both i386.
>
>
> any clues ?
There is a great book written by two guys, Kernighan and Ritchie. It's
called "The C Programming Language". It answers your question.
I could give you a better answer to your question, but that would be
counter-productive, because you'd just continue to make the next beginners
mistake and ask again.
Hint: what does the '*' mean. And what is 'p' initialized to.
//art
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]