if u write max = ~min, max will be stored with the 1's complement of min....
As min is 0 max (in binary) will be 11111........1 31 times...
Hence max gives the max value an unsigned int can...
Type: Posts; User: gooey_kablooie
if u write max = ~min, max will be stored with the 1's complement of min....
As min is 0 max (in binary) will be 11111........1 31 times...
Hence max gives the max value an unsigned int can...
About the feof call reading the last line twice, its not the reading the last line for the second time.
If you want to test for feof then it should be scanned first. For your code its scanning it...
your temp pointer is pointing to some memory not allocated. if u read the man page for strncpy, it says that your destination should be a buffer i.e. u cant pass a pointer that has no memory...
It will throw a problem in the main function as well.
Just follow these steps :
1 . gcc -g "your_c_file"
2. gdb a.out
3. b main
simplest way is to add " name = malloc ( SIZE ) " in ur code...
SIZE depends on your requirement of the number of characters in a name...
Or as you said "point it to a char array".....That...
Hi yougene...
About your segmentation fault :
You haven't allocated memory for char *name. Allocate memory for it and your seg problem is solved.
It worked fine for me.