Forum: C Jul 9th, 2007 |
| Replies: 6 Views: 2,656 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 Jul 5th, 2007 |
| Replies: 12 Views: 1,997 Sorry couldn't help comment off topic..
It's Ms. Naure not Mr. :D
See the avatar? |
Forum: C Jun 29th, 2007 |
| Replies: 6 Views: 7,330 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: 5 Views: 1,196 Accepted. Rephrased: to be more precise defined differently, by compilers, for different compilers.
The point I was trying to make was that for some compilers you might have a defined behavior. |
Forum: C Jun 26th, 2007 |
| Replies: 6 Views: 1,267 I also thought on those lines, but in that case #1 should fail as well.. :) |
Forum: C Jun 25th, 2007 |
| Replies: 20 Views: 5,196 Unless the book is this :)
How Not To Program In C++... |
Forum: C Jun 25th, 2007 |
| Replies: 6 Views: 1,267 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: 5 Views: 1,196 Those links were for C++ here is one link (http://www.difranco.net/cop2220/op-prec.htm) for C.
PS: Like AD said the behavior is undefined or to be more precise defined differently for different... |
Forum: C Jun 25th, 2007 |
| Replies: 5 Views: 1,196 1. The reason why you're getting some junk for last line is because you have given 6 %d(s) inside the format string and supplied only 5 values.
2. Execute the following code and you should see... |
Forum: C Jun 25th, 2007 |
| Replies: 6 Views: 1,267 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 22nd, 2007 |
| Replies: 5 Views: 1,344 1. There 2 basic requirements for storage, A) Temporary B) Persistent.
- Temporary can be achieved using teh structures or arrays or variables (depending on what you wanna store). This would remain... |
Forum: C Jun 22nd, 2007 |
| Replies: 4 Views: 2,711 In simplest terms: Compiler looks at a 2D array as a 1D array that has a 1D array as elements. |
Forum: C Jun 22nd, 2007 |
| Replies: 6 Views: 2,516 Not that it stops you from using clock(). All you gotta do is just put the code in a loop and run it a few 100/1000 times. You'll have your figures. |
Forum: C Jun 22nd, 2007 |
| Replies: 18 Views: 56,678 I donno where/how to tell her.. You're the moderator.. :) I understand you guys have some forums by yourselves.. |
Forum: C Jun 21st, 2007 |
| Replies: 18 Views: 56,678 Couldn't help but notice that unless there is some bug in daniweb.com this is most read thread I've seen so far.. ! 17,751 times.. :) |
Forum: C Jun 20th, 2007 |
| Replies: 5 Views: 3,479 There shouldn't be a "major" difference due to compilers, it's more to do with the platform (OS+H/W) then compiler.
Using same compiler you can use different optimization levels, this should make a... |
Forum: C Jun 20th, 2007 |
| Replies: 4 Views: 882 In Visual Studio 6, by default it creates 2 configurations "Win32 - Debug" and "Win32 - Release". The way to go to debug build is somewhere you have an option (think in Project menu) to "Set active... |
Forum: C Jun 20th, 2007 |
| Replies: 8 Views: 1,292 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 Jun 19th, 2007 |
| Replies: 4 Views: 1,816 Did you check wikipedia ? |
Forum: C Jun 19th, 2007 |
| Replies: 2 Views: 1,700 1. Don't use goto, language provides so many other better/safer/understandable ways.
2. Seems like PORTAbits.RAXX is an int/short instead of a boolean. I would suggest:
A) Trace out their values.... |
Forum: C Jun 17th, 2007 |
| Replies: 1 Views: 2,542 Donno exactly what you wanna know abt the 2 methods but in simplest words when applies to a tree structure with say 3 levels:
BFS: Will test all nodes on one level before moving on to the next... |
Forum: C May 25th, 2007 |
| Replies: 7 Views: 5,620 How do you unpack? I know that my compiler doesn't allow archiving archive files. |
Forum: C May 24th, 2007 |
| Replies: 7 Views: 5,620 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,262 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 23rd, 2007 |
| Replies: 5 Views: 1,088 As already described by AD library calls are calls to functions/APIs exposed /exported by libraries (*.dll+*.lib in windows, *.so and *.a in Unix).
System calls are calling basic OS functions/APIs.... |
Forum: C May 20th, 2007 |
| Replies: 5 Views: 12,999 I'm sure your intentions are good but don't post the complete solutions (http://www.daniweb.com/techtalkforums/thread78060.html). |
Forum: C May 20th, 2007 |
| Replies: 7 Views: 4,251 Although it's just an editor, it would be supporting configuring user tools (I use Textpad which does). Also it's easy to suggest a new IDE but ask those who are in love with their editors and won't... |
Forum: C May 20th, 2007 |
| Replies: 4 Views: 1,449 Do you know what a palindrome is ? |
Forum: C May 10th, 2007 |
| Replies: 8 Views: 1,437 True, but I think the msg is put in many places (like this (http://www.daniweb.com/techtalkforums/announcement8-2.html)and this... |
Forum: C May 10th, 2007 |
| Replies: 3 Views: 7,160 That's because when you provide Chinese instructions to an OS that understands only French it won't understand. :) |
Forum: C May 10th, 2007 |
| Replies: 1 Views: 792 Undefine the macro and define it again.
E.g.
#undef SOMEONE_ELSE_S_MACRO
#define SOMEONE_ELSE_S_MACRO(p1, p2) myfunction_call()
Note:
1. assumed that SOMEONE_ELSE_S_MACRO is defined in already... |
Forum: C May 8th, 2007 |
| Replies: 7 Views: 1,540 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,540 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,540 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 7th, 2007 |
| Replies: 2 Views: 858 I think it should work as it is except if you're doing any bitwise operations (or anything else specific to 16-bit arch) on some of the variables.
This is because word in 32 bit will be bigger than... |
Forum: C May 6th, 2007 |
| Replies: 24 Views: 9,725 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,725 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,725 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,725 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... |
Forum: C Apr 27th, 2007 |
| Replies: 13 Views: 2,007 Well I wasn't gonna reply to Salem's post but now that you've also posted, so I'll say this:
I agree that for anything else than equality it becomes not only unreadable but unwritable as well.
So... |