Forum: C Jul 9th, 2007 |
| Replies: 6 Views: 2,584 Problem is you're copying old to new, whereas what you want to do is new to old. Also using wrong formatting in printf().
See the comments inside the code:
#include <stdio.h>
#include... |
Forum: C Jun 29th, 2007 |
| Replies: 6 Views: 7,135 Here is a link that gives you links for function pointer tutorials.
http://www.google.com/search?q=function+pointer+tutorial
Given you've already implemented stack, you already know that part. If... |
Forum: C Jun 26th, 2007 |
| Replies: 6 Views: 1,254 I also thought on those lines, but in that case #1 should fail as well.. :) |
Forum: C Jun 25th, 2007 |
| Replies: 6 Views: 1,254 Yeah, I believe you, it's just tough to believe. :D
Here is the excerpt from gcc guide if you can figure something more:
3.13 Options for Linking
These options come into play when the... |
Forum: C Jun 25th, 2007 |
| Replies: 6 Views: 1,254 Interesting..
1. I didn't know that -lXYZ could be interpreted by linker as libXYZ.a as well. (thought it's always seen as libXYZ.so). I checked gcc manuals (gcc 4.2.0) and seems fine.
2. Only... |
Forum: C Jun 20th, 2007 |
| Replies: 8 Views: 1,283 Surprised that no one mentioned that they are NOT the same and that's the reason 2 different names are used. As Aia said only rule (according to standards) is
sizeof( short ) ≤ sizeof( int ) ≤... |
Forum: C May 25th, 2007 |
| Replies: 7 Views: 5,377 How do you unpack? I know that my compiler doesn't allow archiving archive files. |
Forum: C May 24th, 2007 |
| Replies: 7 Views: 5,377 Heard of Unix aliases ?!
If you don't wanna do that, you can also say x="that whole command"
and then
$x |
Forum: C May 23rd, 2007 |
| Replies: 3 Views: 2,191 Or in case you've by mistake posted this in C instead of C++ the prototype of interest would be
void foo(int& prm1, int& prm2, int& prm3); |
Forum: C May 8th, 2007 |
| Replies: 7 Views: 1,496 If you had a look at the link this is what you would've seen:
-------------------------------------
Comparing with epsilon – absolute error
Since floating point calculations involve a bit of... |
Forum: C May 8th, 2007 |
| Replies: 7 Views: 1,496 Sorry.. didn't see that one.. :)
Well, if this is an assignment I think the prof's idea is to teach floating point number comparison. See this thread ... |
Forum: C May 8th, 2007 |
| Replies: 7 Views: 1,496 You could post the "idea" as well.. Ppl will tell you if something is wrong.
One I can tell you is:
if (*array > ave)
else if (*array < ave)
Although this is inside the loop it'll always test... |
Forum: C May 6th, 2007 |
| Replies: 24 Views: 9,499 Yup, for non-portable things it would be needed. That's why I mentioned "this particular case". :) |
Forum: C May 5th, 2007 |
| Replies: 24 Views: 9,499 Given that the code posted by me/Vijayan works both on windows and unix #ifdefs won't be needed in this particular case. |
Forum: C May 5th, 2007 |
| Replies: 24 Views: 9,499 In short no, AFAIK ppl don't use getrusage() for this purpose. Because you can as well use time/timex for this purpose.
Difference between what others have suggested here and getrusage() is that... |
Forum: C May 4th, 2007 |
| Replies: 24 Views: 9,499 First I assume your question is how to find out the performance/time of your function. In this case I really donno how you can use Sleep ?!
As I use timing quite frequently I have the following code... |