It's UWAweek 4

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


SVG not supported

Login to reply

👍?
helpful
2:38pm Thu 22nd Aug, ANONYMOUS

So here is question number 10 for the midsem:

(10) Consider the following code which contains a common error:

  #define N       10;
  void function(void)
  {
A)    char array[N];
B)    int x = 2 * N;
C)    for(int i=0 ; i<N  ++i) {
          printf("%c\n", array[i] );
      }
  }

Which of the following lines contains a syntax error? A. Line A. B. Line B. C. Line C. D. All of A, B, and C.

why is A the correct answer? (according to the answer sheet) I know that #define N 10; is a wrong syntax but that is not what line A is pointing at

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