![]() |
.. (לתיקייה המכילה) | |
Can we use the "exit" function in this exercise? | |
Yes but it is not recommended. return; from main is much more neat and leads to better and more maintainable code. (why?) |
Can we #include stdlib.h for exit? | |
Yes (how would you use it otherwise?), but its use is strongly discouraged |
Can we use assert.h? | |
Yes, it is recommended (but won't help you in solving). |
What is assert? | |
It is out of scope and not required. Basically, if its argument is false it crashes the program and reports the line and failed condition. As such, it is useful for test-time sanity checks. |
Why does my email not got answered? | |
You're at the right place. See if your issue has already been addressed here. If it was, but answer is unclear - please note that (and what exactly is unclear) in your email. Also please make sure your mail subject is exactly in the format requested in the exercise (which it should anyway be in a polite mail). We get a lot of emails, and the small effort from your side in writing a formatted and informative subject allows us to more efficiently process them and you get faster answers. |
May we edit the provided code / implement our own versions? | |
Yes, as long as your output matches exercise requirements and expected output, and your code the required conventions and design principles. |
Clarification on line counting | |
in C language statements are separated with a semicolon (';') thus each semicolon counts as a line of code (except inside a for command). condition parentheses also count as a line of code. Concatenation of operators and function calls is not an exemption (one line of code per semicolon) You are allowed to use up to 150 characters per line |
Can I use pointers? | |
Pointers are not needed to solve this assignment. |
Where should I write comments? | |
The rule of thumb: If you need comments - your function/variable names are not informative enough. In a few limited cases you need to comment on a piece of code. Comments are measured for line length too!! |
Tests failed on csm, but everything works fine if I run locally on my machine (redirection or manually). What could be the problem? | |
There are two kind of problems: first, accessing arrays out-of-bounds. CodeBlocks let you do this, linux-gcc will not [tests crashed, and possibly no csm output] second, '\n' on Windows machines is different from '\n' (new line) on linux. Try to not read those characters at all. If you were asked to read numbers - do only this. Do not try to consume all those white spaces. |