![]() |
.. (לתיקייה המכילה) | |
In Question 2, "after each square print an empty line". what do you mean??
|
Each square should start in a new line. (no empty lines between squares). but, after the last square a new line should be printed. that means, the output should end with an empty line. |
In Question 2: "you are allowed to use loops just for reading numbers", can we use loops to read chars as well?
| Yes. |
In Question 2: Can I use a loop to print the whole square?
| No. |
In Question 3: Can I define new methods? or use #define?
| Yes. |
In Question 3: Can I change the given code or method declaration?
|
No. Update: see the question about memory allocation. You should change main so that you treat memory allocation correctly.Otherwise, you cannot change the given method (function) declaration. |
In Question 2, my program does not pass the self-check website tests - the site produces no output when I try to check it
Many of you use scanf("%c") (without white space before %c) or getchar() to read a character from the input, and then check whether it is a white space or a new line by comparing it to ' ' or '\n'.In order to overcome this problem, use scanf(" %c") (with white space before %c), to ignore white spaces in the input - see an explanation in Tutorial 4.
|
In Question 3, in hw5q3.c, you don't check malloc success and don't free the allocated memory at the end. Is it OK?
|
You should change the main to make sure you treat memory allocation correctly. That is, add malloc success check, and free the allocated memory at the end of the program.
|

