PLEASE NOTE: the upgrades to this server, secure.csse.uwa.edu.au, have not yet been completed.
Hopefully the changes will be completed on THURSDAY 8th December.
Web-based programs, such as csmarks, cssubmit, and the help fora, will be unavailable at some time on Thursday 8th.
  It's UWAweek 49

help2002

This forum is provided to promote discussion amongst students enrolled in CITS2002 Systems Programming.
Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

Displaying selected article
Showing 1 of 919 articles.
Currently 4 other people reading this forum.


 UWA week 40 (2nd semester, week 10) ↓
SVG not supported

Login to reply

👍?
helpful
7:15pm Wed 5th Oct, Christopher M.

ANONYMOUS wrote:
> char **strArray = NULL; > strcpy(strArray[0], "adasd"); > > This code will cause a segmentation fault, how can I solve it? I used the malloc function but it still doesn't work.
I can't see any use of malloc() in your code. strArray is NULL, so you cannot access strArray[0]. Even if strArray were not-NULL, strArray[0] does not point to sufficient (not even any) space to hold the string. Have a look at the concordance question in Labsheet-4.

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  1:17AM Sep 14 2022
Privacy policy