It's UWAweek 30 (2nd semester, week 1)

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 1168 articles.
Currently 9 other people reading this forum.


 UWA week 42 (2nd semester, week 12) ↓
SVG not supported

Login to reply

👍?
helpful
4:17pm Thu 19th Oct, Christopher M.

ANONYMOUS wrote:
> 1. Since we are exiting after any problems with memory allocation, does that mean we do not need to realloc() to a temporary variable first, check for NULL, and then assign that temporary variable to our main variable? Or should we do it as good practice anyway?
It's a good practice, but there is probably nothing that we can do if an error is detected.
> 2. Do we have to dynamically allocate memory for the char array that stores every line of the source file while copying, or is it possible to use a constant here? (I think I saw BUFSIZ somewhere?).
Keep in mind that the files might not be text/source files, and so the notion of a 'line' may make no sense.

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  7:24AM Jul 25 2024
Privacy policy