It's UWAweek 42 (2nd semester, week 12)

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


 UWA week 37 (2nd semester, week 7) ↓
SVG not supported

Login to reply

👍?
helpful
10:39pm Thu 12th Sep, Joshua N.

"Songwen You" [email protected] wrote:

Consider the following ml code:

one <- 1
two < one + 1

function add val
    print two + val

The variable two declared by assigning the result of an expression to it, and is accessed in function add, it should be a global variable to allow the access. But in C, you can not use expression when declaring a global variable like:

double one = 1;
double two = one + 1;

To address this issue, I tried to declare it outside of main function, without appoint a value to it:

double one = 1;
double two;

and then in main method, before any other statement, change its value:

two = one + 1;

It can be done like this, but a little bit tricky, and I wonder if it is the original intension of the project or just nobody has thought of it.

Best to ask Amitava for clarification.

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  8:08AM Aug 25 2024
Privacy policy