🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #50484

char * vs char[]

#50484
From: Sean McKeough
Date: Fri, 24 Sep 1993 19:23
15 lines
1047 bytes
The following code gives seg faults when run

char *pword



fscanf(stdin, "%s", pword);


however, it works if I replace *pword by pword[50] why is this?
-- 
----------------------------------------------------------------------------
Sean McKeough                   |  Insolance is bilss.
swmckeough@cayley.uwaterloo.ca  |
----------------------------------------------------------------------------
Technical Details
Message-ID: <CDvHuo.2su@undergrad.math.uwaterloo.ca>
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!math.ohio-state.edu!cs.utexas.edu!utnut!torn!watserv2.uwaterloo.ca!watmath!undergrad.math.uwaterloo.ca!swmckeou

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,f249bebc260afb3e,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-09-24 19:09:43 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!math.ohio-state.edu!cs.utexas.edu!utnut!torn!watserv2.uwaterloo.ca!watmath!undergrad.math.uwaterloo.ca!swmckeou
From: swmckeou@undergrad.math.uwaterloo.ca (Sean McKeough)
Subject: char * vs char[]
Message-ID: <CDvHuo.2su@undergrad.math.uwaterloo.ca>
Sender: news@undergrad.math.uwaterloo.ca
Organization: University of Waterloo
Date: Fri, 24 Sep 1993 19:23:11 GMT
Lines: 15