*BSD News Article 9262


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA5489 ; Fri, 01 Jan 93 01:46:59 EST
Xref: sserve comp.lang.c:37156 comp.unix.bsd:9319
Path: sserve!manuel.anu.edu.au!munnari.oz.au!metro!grivel!alsvid.une.edu.au!mark
From: mark@alsvid.une.edu.au (Mark Garrett Internet: mark@arvak.une.edu.au Phone: +61 66 20 3859)
Newsgroups: comp.lang.c,comp.unix.bsd
Subject: Re: Segmentation faults
Message-ID: <Bzqv3A.Jpz@alsvid.une.edu.au>
Date: 24 Dec 92 03:30:45 GMT
References: <BzGHo4.AK9@fs7.ece.cmu.edu>
Organization: University of New England - Northern Rivers (Lismore)
Lines: 33

>From article <BzGHo4.AK9@fs7.ece.cmu.edu>, by woyansky@flamingo.ece.cmu.edu (George J. Woyansky):
> 
> |> 
> |> 
> |> Hi,
> |>     Why is the following code producing a segmentation fault???
> |> I am compiling this code on an Encore Multimax running UMAX 4.3 Unix.
> |> Please send replies to CBUSCH@ub.d.umn.edu.
> |> 
> [OK frags deleted] 
> |> 
> |> void writexy(x,y,s)
> |> {
> |>    printf("\33[%d;%dH%s",y,x,s);
> |> }
> |>    
> 
> 
> 
> Hmm.  Maybe here?  You need 
> int x,y;
> char s[];
> 
> after your function declaration.

	That is correct the c compiler will have assumed x , y and s to be 
signed integers, thus incorrectly using s.

	Cheers
		Mark :)
-- 
Mark Garrett	Internet:  mark@arvak.une.edu.au	Phone: 	+61 66 20 3859
   University of New England, Northern Rivers, Lismore NSW Australia.