Thanks guys for the help...
I got my program fixed already... :D
Type: Posts; User: wuzzo87
Thanks guys for the help...
I got my program fixed already... :D
Hi,
Why does C return to me -9 when i calculate, -9 % 26 ?
Python gives me what i wanted -9 % 26 = 17. .....
I'm wondering if C has an implementation of mod like Python, or how to go about...
Hey thanks a lot for the help!!!!
certainly is useful
I got it to work already :)
yea, i did that, but, somehow it still doesn't give the right output....
printf("n: %d -- %d\n", n, *number);
is it due to me using 'vi' and typing numbers in a file rather than using...
int main(int argc, char **argv)
{
FILE *fp;
int *number = malloc(sizeof(int));
int n;
fp = fopen(argv[1], "r");
while((n = fread(number, sizeof(int...
Can someone please help me with the usage of fread?
like errm, explain why my small test code don't quite work.
It's just reading a series of numbers(int) from a file.
int main(int argc,...
sorry guys..
i've fixed the problem..
it was a silly mistake of mine :(
Sorry for disturbing..
THX!
like ermm...
is there anything particularly wrong with my hashtable_insert() function and my lookup function?
Ok guys..
i'm so sorry this is a big chunka code....
But this is my problem, there seem to be some missing entries when i insert these stuff into my hashtable...
The input file is as...
Oh yep!...u're right, shouldn't be returning single character from chomp().... thanks
i'ved fixed that, and now segfault, happens in the hashtable_insert() function at the strcpy part....
but...
Hi,
I seem to get a seg fault when i implement this hash function from 'Algorithms in C -Sedgewick' ....
I'm think it's more of my structuring, and pointer problems..
typedef struct {
...
sorry guys,
my fault....
i'm cleaning up the whole code...
There seem to be something wrong with my insertion to the table..
but i'll try to fix that up by myself 1st..
Hey guys..
I'm implementing a simple hash function to test my hash table ... but when i compute value for the hash value, i get this error of which i've never encountered, if i remember
...
haha... ..thank you... I got it!
i did
(*a)->next;
I'll test if the matrix formation's right... :)
Ok thanks Happy_Reaper
i've fixed the -> and thing..but..
i still am not sure how to get rid of this error.... really..
topsort.c:185: error: request for member `next' in something not a...
ops, i'm sorry....here's the function given,
/*
** Dynamically allocate a 2d array of ints of size rows * cols
** and the set the value of all elements to initial_value.
*/
static int **...
btw, i get this compilation errors... not quite sure how to access element within a **node structure type... like 'adjacencies'
topsort.c: In function `convert_to_adj_matrix':
topsort.c:171:...
Hey guys,
I've just learn graph basics and this is the first graph like code i'm facing(topological sort) ....
I need to convert a given adjacency list of the graph to an adjacency matrix...
woops...forgot to add the free() ...again...
Anyway, i've added the <stdbool.h> header to implement bools in C.... :)
Here's it:
int main(int argc, char **argv)
{
int array[100];
int item,j, i=0;
int *comp = malloc(sizeof(int));
int comp_result;
clock_t start, stop;
But the funny thing is,
I did a timing for a mergesort program, and it always results in 0 time interval..
I used a 'double' and %g for printing.
Could it be that the sorting happens too fast?...
Gosh! how silly of me!.... thank you!!
I have to really read up on '*' and '&' operators for pointers...
My utmost gratitude expressed : Thank you everyone!!
KONI, you might just be right! ....
I decided to add this, before the getchar();
like,
while(x<1000000)
x++;
and finally it wasn't 0...but was like 0.09..
Someone help me with pointers plz...
it's the last bit of my prog and it's all done. waahhaahaa...
I'm using Linux Mandrake 10.1 and ran the FAQ program.
The result too was 0.0000.
And my CLOCKS_PER_SECOND is 1000000...
At first start & end is always 0.
After running it for about...