.. (לתיקייה המכילה) | ||
I want to use sqrt/pow from the math library. How can I compile the code with this library | |
When compiling with math function you should also include the flag -lm (which means to add the math library). We will also use this flag to compile your assignment, so you shouldn't worry about it not compiling for us. The new compilation command will be: gcc -std=c99 -Wall -pedantic-errors -Werror -DNDEBUG -lm part1.c -o mtm_tot |
Eclipse won't print my printf until the end of the program, what am I doing wrong? | |
Unfortunately, you stumbled on a known Eclipse bug. There is no real fix, just a workaround. You can add the following line to the beginning of your code: setvbuf (stdout, NULL, _IONBF, 0); This will make Eclipse print without a buffer so everything will print on time, but it will cause some slowness in larger systems that make alt of printing to the screen (not something that happens in Matam). |
How to use I/O redirection with gdb? | |
1. first run gdb with your program name as an argument > gdb mtm_buggy 2. then use redirection with the gdb run command: > run < test1.in > tmpout |
Where should I write my program (which development environment or operating system)? | |
You can use whatever IDE or OS you find comfortable. The only requirement is that the exercises will compile on the csl2 server and will pass the tests on the csl2 server. Clarification: if you wrote the code on Windows using Eclipse (for instance) and it compiles on your local machine but will not compile on csl2 - The exercise will get 0. |
Can I use built in functions like pow or Log2 | |
You are allowed to do so, but note that your solution must be correct for any input. pow and log2 receive a double type variable, and double respresentation may be inaccurate. |
What should the program do in case malloc fails? | |
free all previously allocated memory and exit (return 0). |
Every time I try to launch debug mode, it gets stuck on 62% of launching it. | |
From Eclipse : run --> Debug Configuration Go to "Debugger" tab Then on "GDB debugger" choose manually the location of the debugger by pressing "Browse..." The location of your debugger should be where you installed the GCC program , It should be there under one of the following names : gdb.exe gdb32.exe gdb64.exe |