Search Results

Showing results 1 to 40 of 145
Search took 0.01 seconds.
Search: Posts Made By: death_oclock ; Forum: C and child forums
Forum: C 17 Days Ago
Replies: 2
Views: 269
Posted By death_oclock
I would suggest creating at least one function, getPixel, to make your code more readable. Post this new code and i'll try to take a look.
Forum: C 17 Days Ago
Replies: 2
Views: 262
Posted By death_oclock
Do you have the exact wording of the problem? You cannot turn an unordered list into an ordered one without sorting it.
Forum: C 17 Days Ago
Replies: 12
Views: 509
Posted By death_oclock
A good beginning sort algorithm is the Bubble Sort (http://en.wikipedia.org/wiki/Bubble_sort)
Forum: C 17 Days Ago
Replies: 12
Views: 509
Posted By death_oclock
We can't correctly solve your problem without more information. Post the definitions of your variables and we'll see.
Forum: C 23 Days Ago
Replies: 4
Views: 479
Posted By death_oclock
"We only give homework help to those who show effort (http://www.daniweb.com/forums/announcement118-2.html)"
Forum: C 23 Days Ago
Replies: 3
Views: 271
Posted By death_oclock
My apologies, my advice was not very good. Your original solution is very close but with a few minor tweaks.

Your main should include this (note that N is no longer defined as a pointer and you...
Forum: C 23 Days Ago
Replies: 1
Views: 240
Posted By death_oclock
What output do you get?
Forum: C 23 Days Ago
Replies: 3
Views: 271
Posted By death_oclock
int main()
{
int *a, *N;
Input(a,&N);
Display(a,&N);
getch();
return 0;
}
Forum: C Apr 20th, 2009
Replies: 8
Views: 360
Posted By death_oclock
Oh wow, I forgot about the second call myself. Jepthah: point taken.
Forum: C Apr 19th, 2009
Replies: 8
Views: 360
Posted By death_oclock
"Being cute" was not my intention. I was thinking of efficiency at the time. And while I appreciate the suggestion, it doesn't help my immediate problem.
Forum: C Apr 19th, 2009
Replies: 6
Views: 582
Posted By death_oclock
I hate to sound like a prick but... using fscanf is generally a bad idea. There are plenty of reasons, but a big one is that most people don't really understand what its doing. Therefore it usually...
Forum: C Apr 19th, 2009
Replies: 9
Views: 1,191
Posted By death_oclock
A search through the WinAPI turned nothing like what you want. My guess is that those are things only XP knows and keeps them secret. I could be quite wrong though.
Forum: C Apr 19th, 2009
Replies: 6
Views: 582
Posted By death_oclock
fgets (http://cplusplus.com/reference/clibrary/cstdio/fgets/) and strtok (http://cplusplus.com/reference/clibrary/cstring/strtok/) would be good places to start. Do you know how many strings you will...
Forum: C Apr 19th, 2009
Replies: 8
Views: 360
Posted By death_oclock
I'm getting an error (unhandled exception writing address so and so) trying to modify a string. It gets weirder though. Let me show what i've got:

--Main.c--
#include "stdafx.h"
#include...
Forum: C Apr 2nd, 2009
Replies: 4
Views: 985
Posted By death_oclock
If you already know how to use strtok, why did you use that in your topic title? Well anyway, I think you want something like this:

int r, c;
int arr[numRows][numCols];
while(/*there's another...
Forum: C Apr 1st, 2009
Replies: 4
Views: 438
Posted By death_oclock
Lets just take a look at this code: ptr=n*(malloc(sizeof(n));
ptr=head;
scanf("%d",&ptr->data);
head=ptr->data;
ptr=ptr->next;

You don't need line 1 because you just set it to point to a space...
Forum: C Apr 1st, 2009
Replies: 18
Views: 1,510
Posted By death_oclock
Just a tip: since you are reallocating new memory when you run out of space, you probably want to use realloc (http://cplusplus.com/reference/clibrary/cstdlib/realloc.html). This will keep all the...
Forum: C Mar 30th, 2009
Replies: 10
Solved: minmax
Views: 696
Posted By death_oclock
Ark's approach is much neater and most likely works. Your solution is very hard to read; the looping approach makes more sense.
Forum: C Mar 30th, 2009
Replies: 10
Solved: minmax
Views: 696
Posted By death_oclock
Purely for the sake of simplicity, I would go with this route (doesn't use a second set of variables):


int main( int argc, char *argv[] ){
int *numberlist, i, n, min, max ;

n = atoi(...
Forum: C Mar 19th, 2009
Replies: 6
Views: 489
Posted By death_oclock
Are you trying to emulate a DOS environment using C? Post the relevant code you have already, what it is supposed to do, and what it is doing wrong.
Forum: C Mar 12th, 2009
Replies: 4
Solved: Memory Leak
Views: 364
Posted By death_oclock
Sorry, I should have posted the types I defined; REALIZATION is a pointer in itself, so in that aspect the program works. What is the benefit to clearing a block of memory before freeing it though?
Forum: C Mar 11th, 2009
Replies: 4
Solved: Memory Leak
Views: 364
Posted By death_oclock
Nevermind, I caught it. I didn't free pitches inside randomActualChord().
Forum: C Mar 11th, 2009
Replies: 4
Solved: Memory Leak
Views: 364
Posted By death_oclock
My program is getting hung up somewhere in the function evolveRealization and while it is stuck its memory usage is increasing by around 1MB per second! While it is building up generations, it was...
Forum: C Mar 10th, 2009
Replies: 8
Views: 548
Posted By death_oclock
Well this isn't a terribly performance-intensive part of my program, and I have to submit the whole bloody thing by friday, so maybe i'll get to it another time, and post the results if anyone is...
Forum: C Mar 10th, 2009
Replies: 8
Views: 548
Posted By death_oclock
Would that solution be more or less efficient than calling a function like this on the data before writing:

void swapEndianL(unsigned int *x)
{
*x = (*x>>24) |
((*x << 8) & 0x00FF0000) |
...
Forum: C Mar 10th, 2009
Replies: 8
Views: 548
Posted By death_oclock
Is there any way to force fwrite() to write in big-endian format no matter what? I am trying to write a MIDI file and they are always big-endian. Converting every value I write to big endian...
Forum: C Mar 8th, 2009
Replies: 3
Views: 1,245
Posted By death_oclock
I see, thank you.
Forum: C Mar 8th, 2009
Replies: 3
Views: 1,245
Posted By death_oclock
I had forgotten about calloc for the longest time, but I was recently reminded of it. Now i'm curious, what would be the difference between malloc(numElems * elemSize); and calloc(numElems,...
Forum: C Mar 5th, 2009
Replies: 4
Views: 1,695
Posted By death_oclock
For the purpose of adding a one dimensional array works well enough in representing a matrix. For more complicated operations though, it would likely be easier to define a matrix like int...
Forum: C Mar 4th, 2009
Replies: 6
Views: 510
Posted By death_oclock
No, you don't pass in the filename; you pass an already opened file pointer (FILE *).
Forum: C Mar 4th, 2009
Replies: 13
Views: 647
Posted By death_oclock
That's true. You don't seem to be getting the point here. A string is an array of chars. An array of strings (multiple names) must be an array of arrays of string. Therefore you have the two...
Forum: C Mar 3rd, 2009
Replies: 6
Views: 510
Posted By death_oclock
You can replace that with a call to rewind(infile) (http://cplusplus.com/reference/clibrary/cstdio/rewind.html).
Forum: C Mar 3rd, 2009
Replies: 2
Views: 235
Posted By death_oclock
You can't define variables in the for loop header, so you need to put int i; somewhere else.
Forum: C Mar 3rd, 2009
Replies: 13
Views: 647
Posted By death_oclock
char stu_name[10]; is defining just one string that can hold 9 characters. You should define it like char stu_names[10][NAME_LENGTH];. And no, you should never add system("pause");
Forum: C Mar 2nd, 2009
Replies: 5
Views: 235
Posted By death_oclock
That would be a great plan if you were trying to write bad-looking and terribly inflexible code. You can do this with a loop, however, which will let you find the maximum of any amount of numbers you...
Forum: C Mar 2nd, 2009
Replies: 7
Views: 9,062
Posted By death_oclock
Why, in any circumstance, would resurrecting a four year old thread to ask a vague question using bad grammar (forget english grammar, I mean C grammar. C doesn't have "commands") be a good idea?...
Forum: C Mar 1st, 2009
Replies: 4
Views: 801
Posted By death_oclock
Think about array indices. To write them from beginning to end, you would start at 0 and go to arrayLength - 1. How might you do the opposite?
Forum: C Mar 1st, 2009
Replies: 1
Views: 259
Posted By death_oclock
Take a look at the aspell (http://aspell.net/) dictionary.
Forum: C Feb 28th, 2009
Replies: 2
Views: 429
Posted By death_oclock
Does this mean that you have one implementation already? Try posting it so we can see what it is you need to modify.
Forum: C Feb 28th, 2009
Replies: 4
Views: 368
Posted By death_oclock
But it is an alternative to adding a 0 border around the main grid. To me, edge checking would make more sense.
Showing results 1 to 40 of 145

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC