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 19th, 2009 |
| Replies: 12 Views: 527 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 5th, 2009 |
| Replies: 9 Views: 857 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,106 >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: 2 Views: 254 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: 581 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,574 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: 2 Views: 419 In addition (personally one of my favourite links):
http://cboard.cprogramming.com/c-programming/88495-development-process.html |
Forum: C Sep 12th, 2009 |
| Replies: 12 Views: 1,038 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 Aug 28th, 2009 |
| Replies: 8 Views: 501 >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 24th, 2009 |
| Replies: 4 Views: 512 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: 418 Here's something essential, start from this and write the rest on your own:
#include <stdio.h>
/*
Your function declarations
*/
int main(void)
{
/* |
Forum: C Aug 21st, 2009 |
| Replies: 2 Views: 288 I guess he's using Turbo Crap v3.0 :P
Could you provide us:
The program which you did try to compile.
The complete linker error message. |
Forum: C Jul 30th, 2009 |
| Replies: 17 Views: 669 @RobBrown:
>was rather unhelpful, and honestly not very bright...
I'm very sorry that my eyes aren't good enough to see the error messages on your computer's monitor.
Do you maybe expect that... |
Forum: C Jul 29th, 2009 |
| Replies: 8 Views: 297 Nope, not a joke.
It's just: most of the time the word 'byte' is interpreted as an octet of bits (8 bits), but this is not fully correct, as a byte is an abstract term for the smallest addressable... |
Forum: C Jul 26th, 2009 |
| Replies: 9 Views: 612 Some important things you should pay attention to:
Please wrap your code between code tags:
// your code here
Don't use void main() it's evil, use int main() instead.
Use proper... |
Forum: C Jul 16th, 2009 |
| Replies: 7 Views: 337 1) Yes you helped him, but in what a way?
Many people here on Daniweb are great programmers, but they don't give away free code, they rather want to guide the OP through the process on how to... |
Forum: C Jul 15th, 2009 |
| Replies: 8 Views: 643 And I did my best to politely ask him :'( |
Forum: C Jul 13th, 2009 |
| Replies: 2 Views: 289 Welcome to this forum, tangent03.
Could you please check out this (http://www.daniweb.com/forums/announcement8-3.html) page, and add code tags to your future posts?
Also, don't use void main(),... |
Forum: C Jul 13th, 2009 |
| Replies: 5 Views: 273 What I guess is that the name "my code" is not a very appropriate name for this thread, because the OP probably didn't even write this code himself.
But who knows? Only the OP, right?
But if he... |
Forum: C Jul 7th, 2009 |
| Replies: 2 Views: 286 If you specify %d in the format string of the printf() function, you also have to specify a corresponding integer value to print.
General rule: For each format specifier you include in the format... |
Forum: C Jun 30th, 2009 |
| Replies: 21 Views: 1,268 Eureka!
I've found one, Dave:
http://www.daniweb.com/code/snippet258.html
:) |
Forum: C Jun 29th, 2009 |
| Replies: 2 Views: 275 >Do you think this would cause memory problem?
Well, that actually depends on how much RAM there's inside your computer, whether you're planning to create arrays of structures, etc. ...
You can... |
Forum: C Jun 23rd, 2009 |
| Replies: 7 Views: 577 Seems like the OP isn't very interested in being helped? |
Forum: C Jun 23rd, 2009 |
| Replies: 11 Views: 588 It could be that a moderator hasn't told you, but I hope you agree with me that if you're saying that, then you're just provocating any member on this forum, are you maybe thinking that you're a God... |
Forum: C Jun 13th, 2009 |
| Replies: 9 Views: 446 >i dunno im sure this output the good result
Did you actually write this?
>i dont understand why it got not the output that i want
Explain us what output you are expecting, then it's easier for... |
Forum: C Jun 11th, 2009 |
| Replies: 8 Views: 878 >Please guide me how can I access the data of a void type buffer?
Normally malloc is used in a way like this:
int *p;
p = (int *) malloc( 50 * sizeof( int ) ); // allocate space for 50... |
Forum: C Jun 7th, 2009 |
| Replies: 11 Views: 667 Welcome to the world of C!
It's not because it seems working that it actually works!
BTW, Why would you ever need to specify a negative subscript?
(Maybe because you want to write in some memory... |
Forum: C Jun 7th, 2009 |
| Replies: 10 Views: 595 Describing the problem:
Take a look at this:
int i,j;
float H [100][100];
FILE*in;
in=fopen("0.txt","rt"); // you make an assignment here (1)
FILE*out; |
Forum: C Jun 1st, 2009 |
| Replies: 22 Views: 962 void main() is evil, make it int main() (read this (http://www.gidnetwork.com/b-66.html))
#include <conio.h> remember that conio isn't a part of the standard C library :)
BTW, Why don't you use a... |
Forum: C Jun 1st, 2009 |
| Replies: 9 Views: 385 Aaaaaaaaaaargh! void main(), don't use it, it's evil (check this (http://www.gidnetwork.com/b-66.html) page) !!
Use int main() instead :)
You should also read this... |
Forum: C Apr 25th, 2009 |
| Replies: 8 Views: 927 sentence is the string where the sscanf function reads from, in the string "Rudolph is 12 years old" you've 4 words and 1 number, but for the sscanf function these are just 5 values:
1) Rudolph
2)... |