PLEASE NOTE: the upgrades to this server,, 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


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 5 other people reading this forum.

 UWA week 36 (2nd semester, mid-semester break) ↓
SVG not supported

Login to reply

7:20am Wed 7th Sep, Christopher M.

"Haoxuan Long" <23*4*1*[email protected]*u*e*t*u*a*e*u*a*> wrote:
> why do we need a *origdest variable? Can't we just return *dest?
This example has followed the way the standard strcpy() function works. While C doesn't have a basic string datatype, we can't copy strings with string2 = string1; So strcpy() is written so that we can read it the same way - strcpy(string2, string1); Then, the result of the function is (the start of) string2, so that we can write: printf("result is %s\n", strcpy(string2, string1) ); or strcpy(string3, strcpy(string2, string1) ); analogous to: string3 = string2 = string1; There would be little point returning the value of dest in the provided implementation, as it's a pointer which always points to a null-byte, and we have no way of knowing which string that actually relates to.

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