I see people like to use uint8 for buff declaration. It looks good to me as well, but I just wonder which header file I should include to use that type or I have to define it by myself? I think it...
Type: Posts; User: icoigo
I see people like to use uint8 for buff declaration. It looks good to me as well, but I just wonder which header file I should include to use that type or I have to define it by myself? I think it...
Is there any demonstration to show how to translate recursion into non-recursion by not using explicit stack?
No idea how or even know if my recursive method can be translated into non-recursion one.
What do you mean by "not really worth it"? Those options has any drawback?
Cool, after compiling with -O3 option, the C program only takes 1990 milli-seconds to get the result.
I use gcc on my iMac, both program(Java and C) are run in terminal. OS is Mac OS X 10.6.4
I don't think I turn on the optimizations option, can you tell me how?
I change my C program codes as suggested, no memory allocation any more. I change my Java codes as well, no clone data.
However, Java program takes 2049 milli-seconds while C program takes 2969...
After changing the codes as above, change the way to allocate and free memory, the C program only takes 33 seconds to get the result. Pretty cool!
As my first post said, I know this should be the biggest time consuming.
I just what to know how to improve it because I am new to C, that also mean I am new to memory management stuff.
Hi All,
This is the code of the recursive method. Thank you all for your reply and take time to help me improve my C programming skill.
Java code:
public static boolean...
I was a Java programer, I start to learn C programming now. I thought C is faster than Java, and the performance is much better because games are most likely written in C.
Last night I wrote a...
Thanks for your codes, but I don't want to validate the input and throw out an error message to terminate my program, I just want to ignore the useless user input(those characters beyond the first 10...
No.
The real problem is, I want to store user input into a char[], so I can allocate memory as char[10], I expect the user input data 10 bytes each row, and I will request the user input for 3 rows,...
<<< split from http://cboard.cprogramming.com/c-programming/65068-fgets-while-loop.html >>>
I have the same problem now, how to solve this?
Use another fgets to retrieve those "rubbish data" and...
If I have an array which its size is based on the user input, from some material, I need to use malloc function to allocate memory for that array what is known dynamic array. Don't forget to free it....