Forum: C Sep 18th, 2009 |
| Replies: 2 Views: 325 Standard C doesn't allow you to declare variables in the middle of statement blocks. |
Forum: C Sep 18th, 2009 |
| Replies: 3 Views: 639 http://www.daniweb.com/forums/thread223648.html
The amount of effort it took just to reverse a string makes this near impossible for you.
You need some more intermediate steps if you actually... |
Forum: C Sep 17th, 2009 |
| Replies: 20 Views: 807 Post your code!
Did you initialise i ? |
Forum: C Sep 17th, 2009 |
| Replies: 20 Views: 807 result[numchars++] = basechars[r];
When you're done, print from numchars-1 back down to 0 (one char at a time). |
Forum: C Sep 17th, 2009 |
| Replies: 2 Views: 401 > typedef struct queue_type *Queue;
This should come AFTER your actual struct declaration. |
Forum: C Sep 17th, 2009 |
| Replies: 20 Views: 807 > basechars[r]
You're printing them, not storing them! |
Forum: C Sep 17th, 2009 |
| Replies: 5 Views: 343 Well writing it on Linux using g++ would be a real test of your skill at writing portable software that will compile on ANY compiler. |
Forum: C Sep 17th, 2009 |
| Replies: 20 Views: 807 Store each char in another array, then print it out backwards? |
Forum: C Sep 17th, 2009 |
| Replies: 20 Views: 807 Well it's good for bases < 10
char basechars[] = "0123456789";
and
printf("%c", basechars[r] ); |
Forum: C Sep 17th, 2009 |
| Replies: 8 Views: 252 More cross-forum spamming
http://cboard.cprogramming.com/c-programming/119681-help-c-code.html
Ever feel like you're just wasting effort reading and answering the SAME question over and over... |
Forum: C Sep 17th, 2009 |
| Replies: 5 Views: 343 > I use only linux and I am unable find the compiler.
And what are you going to do with the executable when you've compiled your code? |
Forum: C Sep 17th, 2009 |
| Replies: 5 Views: 299 char *words[n];
words[0] = wordlist[0];
And so on. |
Forum: C Sep 17th, 2009 |
| Replies: 20 Views: 807 > That is how I get the binary.
That's how you do it for every other base as well. |
Forum: C Sep 17th, 2009 |
| Replies: 2 Views: 483 16 replies over here -> http://cboard.cprogramming.com/c-programming/119668-circular-buffer.html
In other news -> http://www.catb.org/~esr/faqs/smart-questions.html#forum
And finally, the... |
Forum: C Sep 16th, 2009 |
| Replies: 5 Views: 299 Sure, but that would take up more memory.
You would need to store an array of char* somewhere. |
Forum: C Sep 16th, 2009 |
| Replies: 4 Views: 248 http://cboard.cprogramming.com/c-programming/119649-malloc-why.html |
Forum: C Sep 16th, 2009 |
| Replies: 5 Views: 299 A pointer to a 2D array is not a **
http://www.daniweb.com/forums/post859293.html#post859293
Use the typedef approach if you want to keep your sanity ;) |
Forum: C Sep 16th, 2009 |
| Replies: 7 Views: 319 True, removing the redundant #include <iostream> and making sure to invoke the C compiler would be a lot simpler than going the other way. |
Forum: C Sep 15th, 2009 |
| Replies: 3 Views: 279 > Not sure why you have two while loops?
Just copy/paste - nothing more
And your while loop is far too complex.
Put most of the code into the body of the loop. |
Forum: C Sep 15th, 2009 |
| Replies: 16 Views: 681 > temp=(char**)malloc(rows);
The red is a cast expression, and is unnecessary.
And it is also HORRIFICALLY wrong on the size as well - damn, didn't spot that one earlier.
It should be
temp=... |
Forum: C Sep 15th, 2009 |
| Replies: 3 Views: 279 Well you're not using fscanf correctly, so no wonder it blows up.
int val;
while ( while(fscanf(dFile, "%1d", &val ) == 1 ) |
Forum: C Sep 14th, 2009 |
| Replies: 4 Views: 757 Use integers.
Or tell us the problem you're really trying to solve, rather than attempting to fix your solution with one line of code. |
Forum: C Sep 14th, 2009 |
| Replies: 5 Views: 694 How would I know.
You've now got two programs, and you've posted the code for neither of them. |
Forum: C Sep 14th, 2009 |
| Replies: 16 Views: 681 > char t=address_array(M,N);
You're returning a char**, so try
char **t=address_array(M,N);
> printf ("%s",t);
Try (with the first fix)
printf ("%s",t[0]);
> for(j=0; j<columns; j++)
OK,... |
Forum: C Sep 14th, 2009 |
| Replies: 5 Views: 694 if(! CreateProcess("C:\\WINDOWS\\system32\\cmd.exe",
This needs to be something like
if(! CreateProcess("C:\\Users\\me\\Documents\\Projects\\Fib\\myfib.exe",
It does all the work.
This code... |
Forum: C Sep 14th, 2009 |
| Replies: 16 Views: 681 So replace float** with char** and a different kind of scanf call. |
Forum: C Sep 13th, 2009 |
| Replies: 3 Views: 263 |
Forum: C Sep 13th, 2009 |
| Replies: 2 Views: 215 Use %s to print a string of chars. |
Forum: C Sep 13th, 2009 |
| Replies: 3 Views: 263 You mean like a web browser? |
Forum: C Sep 13th, 2009 |
| Replies: 3 Views: 283 counter += 1*(ch=='(') - 1*(ch==')');
It's cryptic because anything simple is the whole answer on a plate. |
Forum: C Sep 13th, 2009 |
| Replies: 3 Views: 283 |
Forum: C Sep 13th, 2009 |
| Replies: 4 Views: 281 fopen() to open a file, fclose() to close it when you're done.
fgets() to read each line from the file
sscanf() to extract information from the line
The first step is to show you can read the... |
Forum: C Sep 13th, 2009 |
| Replies: 1 Views: 265 Already answered
http://cboard.cprogramming.com/c-programming/119526-help-lru-replacemnet.html |
Forum: C Sep 13th, 2009 |
| Replies: 4 Views: 281 > How I will load it and then assign it to hash table
So is this about reading files, or hash tables? |
Forum: C Sep 13th, 2009 |
| Replies: 3 Views: 330 > if(fgets(temp, sizeof(temp), file) != NULL)
To read the whole file, do
while(fgets(temp, sizeof(temp), file) != NULL)
Oh, and remove the fclose() from inside the loop.
Or better yet, leave... |
Forum: C Sep 12th, 2009 |
| Replies: 3 Views: 273 > i have some work for school that have to finish fast
What else is new (http://www.catb.org/~esr/faqs/smart-questions.html#urgent)
> code that I've found here is written in C++ and i need it in... |
Forum: C Sep 12th, 2009 |
| Replies: 1 Views: 397 |
Forum: C Sep 12th, 2009 |
| Replies: 4 Views: 757 Like the error message says, you can only do xor on integers. |
Forum: C Sep 12th, 2009 |
| Replies: 8 Views: 414 > 1) Can you help me how can i achieve this in Visual Studio?
http://www.codeguru.com/forum/showthread.php?t=312742
http://msdn.microsoft.com/en-us/library/e5ewb1h3(VS.80).aspx |
Forum: C Sep 12th, 2009 |
| Replies: 12 Views: 977 The array sizeof thing only works when the definition of the array is in scope - that is, the compiler can see the actual array.
An array declaration, say
extern int array[ ];
or an array... |