Forum: C Nov 8th, 2009 |
| Replies: 1 Views: 714 A program which displays the prime factors of a given number, all the 'hard' work is done by the factorize() function:
/* Find out the prime factors
* of a given number and print
* them on the... |
Forum: C Oct 21st, 2009 |
| Replies: 9 Views: 388 Dev-C++ is Windows software, so I think it is safe to assume that he's using Windows. |
Forum: C Oct 20th, 2009 |
| Replies: 9 Views: 388 Before throwing insults to the compiler, could you maybe first post your 100% right code? |
Forum: C Oct 20th, 2009 |
| Replies: 4 Views: 371 What exactly is the purpose of your code?
To me it seems like you're reading a file character by character, and then printing out only the digits?
Why doing a conversion to integer if you only... |
Forum: C Oct 20th, 2009 |
| Replies: 10 Views: 506 Small addition:
(if the return statement was placed inside the main function). |
Forum: C Oct 19th, 2009 |
| Replies: 6 Views: 279 Can you maybe show us what you've attempted already?
If you've nothing (i.e. no code) to show us, then this (for us) means that you haven't made any effort.... |
Forum: C Oct 19th, 2009 |
| Replies: 12 Views: 517 You can always put the call to printf in an if-statement, like this:
#include <stdio.h>
int main(void)
{
if( printf("Hello World!\n") ) {}
return 0;
}
As you can see, no semicolon... |
Forum: C Oct 17th, 2009 |
| Replies: 2 Views: 407 And what exactly is your question? |
Forum: C Oct 16th, 2009 |
| Replies: 4 Views: 286 >how can I put: CAN'T BE DIVIDED BY 4?
if( (N == 2) && (T % 4) )
{
/* Your code here */
} |
Forum: C Oct 16th, 2009 |
| Replies: 3 Views: 351 >I have tried the string length function and it does not work im wondering if someone can point me in the right direction?
As StaticX has told you, you can use the strlen function only if the array... |
Forum: C Oct 7th, 2009 |
| Replies: 3 Views: 276 Take a look at strcat (http://www.cplusplus.com/reference/clibrary/cstring/strcat/).
But strcat on it's own won't solve the whole thing, you'll have to do some other things as well, things which I'd... |
Forum: C Oct 5th, 2009 |
| Replies: 9 Views: 849 I've to admit that the union approach was just a bad and clunky advice.
But I just can't get this:
Why would someone use an unportable function to do the job when there's a portable function which... |
Forum: C Oct 4th, 2009 |
| Replies: 5 Views: 7,085 >use fgets() instead of scanf() because it avoids buffer overflow problems if you type in more characters than name will hold.
I'm not going to repeat what Tom Gunn said once, I'm just going to link... |
Forum: C Oct 2nd, 2009 |
| Replies: 9 Views: 849 >it will return a number for example 9999, which will be an Integer. Now how to convert this 9999 into ASCII?
You could use a union for this purpose:
union foo {
int port;
char asc[... |
Forum: C Oct 2nd, 2009 |
| Replies: 2 Views: 252 And...why do I have to do this when the assignment has been given to you?
I suggest you to have a nice read: http://www.daniweb.com/forums/announcement8-2.html :)
Come back when you've something to... |
Forum: C Oct 1st, 2009 |
| Replies: 5 Views: 567 >It might be nice to provide some "test" or "driver" code in which some example of this function's input and output are demonstrated.
Okay, here you go:
#include <stdio.h>
#include <limits.h>... |
Forum: C Oct 1st, 2009 |
| Replies: 5 Views: 567 Oops, I forgot to mention you should include the limits.h header.
Or... did I miss the point of your post? |
Forum: C Oct 1st, 2009 |
| Replies: 5 Views: 567 As the title says: a C function for detecting anagrams.
Returns true if both strings are anagrams, returns false otherwise. |
Forum: C Sep 21st, 2009 |
| Replies: 17 Views: 1,567 In my previous post I forgot to point out that 0xFFFFFFFF has a binary representation wherein every bit is one, if such a binary value goes into a signed integer variable, then the variable contains... |
Forum: C Sep 21st, 2009 |
| Replies: 17 Views: 1,567 Oh sorry, I forgot to answer that one :P
Just as a convenience for anyone who's reading the thread:
Well, this is because in your code you use signed ints (that is what you get when you declare a... |
Forum: C Sep 21st, 2009 |
| Replies: 17 Views: 1,567 This code is wrong when you want to display the size of a char (in bits):
printf("Size of char: %d-bits\n", sizeof(char)*4);
Sure it will report that a char variable consists out of 4 bits, but... |
Forum: C Sep 20th, 2009 |
| Replies: 7 Views: 466 In your previous thread you've already been suggested to use code tags, perhaps you missed it?
Anyway here (http://www.daniweb.com/forums/announcement118-3.html)'s the link which will directly bring... |
Forum: C Sep 20th, 2009 |
| Replies: 2 Views: 415 In addition (personally one of my favourite links):
http://cboard.cprogramming.com/c-programming/88495-development-process.html |
Forum: C Sep 17th, 2009 |
| Replies: 5 Views: 388 >I use only linux and I am unable find the compiler.
>Any help will be much appreciated as I am stuck.
AFAIK it isn't available for Linux, however you might be able to get it work if you use Wine... |
Forum: C Sep 12th, 2009 |
| Replies: 12 Views: 1,031 Using a 'normal' array this isn't possible in C, you could maybe try your hands on a linked list (http://www.eternallyconfuzzled.com/tuts/datastructures/jsw_tut_linklist.aspx)? |
Forum: C Sep 12th, 2009 |
| Replies: 12 Views: 1,031 But how can you compile that? It isn't possible, my compiler even produces error messages, which is logical in such a case:
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
tttt.cpp:... |
Forum: C Sep 12th, 2009 |
| Replies: 12 Views: 1,031 I don't believe that's the smallest compilable solution to reproduce the problem. |
Forum: C Sep 12th, 2009 |
| Replies: 12 Views: 1,031 Do I understand this correctly? You want to create an array which' size can increase dynamically as elements are added or removed?
Again: please post down the smallest compilable code which I can... |
Forum: C Sep 12th, 2009 |
| Replies: 12 Views: 1,031 Did you declare the array like this:
int x[] = {5, 7, 9, 2}; // put some values in it
?
Could you provide me with the smallest compilable solution which doesn't work correctly on your... |
Forum: C Sep 12th, 2009 |
| Replies: 12 Views: 1,031 You can only declare an array like this:
int frameScores[];
if you directly initialize it, otherwise that declaration is impossible (there's no way for the compiler to find out the length of the... |
Forum: C Sep 9th, 2009 |
| Replies: 2 Views: 355 You mean that the output on your screen has to look like this:
\n ?
In that case, you just print the following string to your screen: "\\n" :) |
Forum: C Aug 28th, 2009 |
| Replies: 8 Views: 497 >Got exam tomorrow
Cool! I've exams too within 3-and-a-half months, wish me the best :P.
>Erm, such like syntax error that kind, got what other type of error else?
So, if I don't misunderstand... |
Forum: C Aug 27th, 2009 |
| Replies: 4 Views: 778 In addition: http://www.gidnetwork.com/b-43.html |
Forum: C Aug 27th, 2009 |
| Replies: 6 Views: 515 I hope the OP has read the first word: 'never', otherwise it could have turned out else :P |
Forum: C Aug 24th, 2009 |
| Replies: 5 Views: 291 Well, I need to see the error messages, could you post them all down ?
Did you actually write this code yourself? |
Forum: C Aug 24th, 2009 |
| Replies: 4 Views: 506 void main() is bad, references:
http://www.gidnetwork.com/b-66.html
http://users.aber.ac.uk/auj/voidmain.shtml
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044841143&id=1043284376 |
Forum: C Aug 24th, 2009 |
| Replies: 5 Views: 291 In your previous thread (http://www.daniweb.com/forums/thread213572.html) I told you to use code tags, and I provided you a link to the forum announcement, now you're still not able to use them... |
Forum: C Aug 24th, 2009 |
| Replies: 10 Views: 719 Hard time using a search engine?
http://www.lmgtfy.com/?q=pass+by+value+or+reference |
Forum: C Aug 24th, 2009 |
| Replies: 4 Views: 506 Wait, I doubt whether this program will correctly terminate on every machine, it appears that it won't, because you're using void main(), the standard says that you must use int main() and not void... |
Forum: C Aug 24th, 2009 |
| Replies: 6 Views: 416 Here's something essential, start from this and write the rest on your own:
#include <stdio.h>
/*
Your function declarations
*/
int main(void)
{
/* |