Mail Archives: djgpp/1998/01/26/07:45:17
Richard Chappell wrote:
why on earth did you post a rhide bug report? the fact that you don't
know C is not a bug in rhide for god's sake.
basic C questions are off-topic for this ng. you'd be better off asking
them in news:comp.lang.c or news:comp.lang.c.moderated. and believe it
or not, the comp.lang.c faq (there is a we version, search for it on
yahoo) is a good thing to read.
> My problem is the following:
> ============================
> this is my sample program...
>
> #include <stdio.h>
>
> typedef struct
> {
> int za;
> } mystruct;
>
> int main()
> {
> mystruct a[2];
> mystruct b;
> mystruct *p,*p2;
>
> a[0].za=98;
> a[1].za=99;
> b.za=5;
> *p=b; // for this one I get a SIGSEGV error
write what you mean. you mean 'i want p to point to b, right?
p = &b;
> p2=a[0]; // for this one I get a 'incompatible types in assignment'
again, you want p2 to to point to the first element of the array, you do
not want to assign a mystruct to p2.
p2 = a;
or
p2 = &a[0];
should work.
--
----------------------------------------------------------------------
A. Sinan Unur
Department of Policy Analysis and Management, College of Human Ecology,
Cornell University, Ithaca, NY 14853, USA
mailto:sinan DOT unur AT cornell DOT edu
http://www.people.cornell.edu/pages/asu1/
- Raw text -