DJSAN10 28 Posting Whiz in Training

How to send EOF on console in linux?

DJSAN10 28 Posting Whiz in Training

what is the basic difference between unix and linux,fedora etc

DJSAN10 28 Posting Whiz in Training

That ws grt..thanx :)

DJSAN10 28 Posting Whiz in Training

May i know the procedure in brief if possible

DJSAN10 28 Posting Whiz in Training

Method1
(The XOR trick) a ^= b ^= a ^= b;
Although the code above works fine for most of the cases, it tries to modify variable 'a' two times between sequence points, so the behavior is undefined. What this means is it wont work in all the cases. This will also not work for floating-point values. Also, think of a scenario where you have written your code like this

swap(int *a, int *b)
{
*a ^= *b ^= *a ^= *b;
}
Now, if suppose, by mistake, your code passes the pointer to the same variable to this function. Guess what happens? Since Xor'ing an element with itself sets the variable to zero, this routine will end up setting the variable to zero (ideally it should have swapped the variable with itself). This scenario is quite possible in sorting algorithms which sometimes try to swap a variable with itself (maybe due to some small, but not so fatal coding error). One solution to this problem is to check if the numbers to be swapped are already equal to each other. swap(int *a, int *b) {
if(*a!=*b) { *a ^= *b ^= *a ^= *b; } }

Method2 This method is also quite popular a=a+b; b=a-b; a=a-b; But, note that here also, if a and b are big and their addition is bigger than the size of an int, even this might end up giving you wrong results. Method3 One can …

Salem commented: nicely put +17
DJSAN10 28 Posting Whiz in Training

Could anyone please explain what exactly bootstrapping is?
As far as i know it is something related to "the compiler for C itself wriiten in C"

DJSAN10 28 Posting Whiz in Training

thnx a lot 2 both :) :)

DJSAN10 28 Posting Whiz in Training

ohk..thnx :)

DJSAN10 28 Posting Whiz in Training

If the main() takes 3 arguments i.e. int argc,char * argv[],char *env[] and SINCE C DOES NOT SUPPORT FUNCTION OVERLOADING ,y does the c compiler does not give error for simply

void main() //that is no arguments at all

OR

void main(int argc,char *argv[]) //2 arguments