home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 18850 < prev    next >
Encoding:
Internet Message Format  |  1992-12-23  |  1.3 KB

  1. Xref: sparky comp.lang.c:18850 comp.unix.bsd:10611
  2. Path: sparky!uunet!munnari.oz.au!metro!grivel!alsvid.une.edu.au!mark
  3. From: mark@alsvid.une.edu.au (Mark Garrett Internet: mark@arvak.une.edu.au Phone: +61 66 20 3859)
  4. Newsgroups: comp.lang.c,comp.unix.bsd
  5. Subject: Re: Segmentation faults
  6. Message-ID: <Bzqv3A.Jpz@alsvid.une.edu.au>
  7. Date: 24 Dec 92 03:30:45 GMT
  8. References: <BzGHo4.AK9@fs7.ece.cmu.edu>
  9. Organization: University of New England - Northern Rivers (Lismore)
  10. Lines: 33
  11.  
  12. From article <BzGHo4.AK9@fs7.ece.cmu.edu>, by woyansky@flamingo.ece.cmu.edu (George J. Woyansky):
  13. > |> 
  14. > |> 
  15. > |> Hi,
  16. > |>     Why is the following code producing a segmentation fault???
  17. > |> I am compiling this code on an Encore Multimax running UMAX 4.3 Unix.
  18. > |> Please send replies to CBUSCH@ub.d.umn.edu.
  19. > |> 
  20. > [OK frags deleted] 
  21. > |> 
  22. > |> void writexy(x,y,s)
  23. > |> {
  24. > |>    printf("\33[%d;%dH%s",y,x,s);
  25. > |> }
  26. > |>    
  27. > Hmm.  Maybe here?  You need 
  28. > int x,y;
  29. > char s[];
  30. > after your function declaration.
  31.  
  32.     That is correct the c compiler will have assumed x , y and s to be 
  33. signed integers, thus incorrectly using s.
  34.  
  35.     Cheers
  36.         Mark :)
  37. -- 
  38. Mark Garrett    Internet:  mark@arvak.une.edu.au    Phone:     +61 66 20 3859
  39.    University of New England, Northern Rivers, Lismore NSW Australia.
  40.