BinaryByter
|= is the same as c = c | 2;
BinaryByter
| is the "bitwise or" operator
I_Interface
BinaryByter
sure 😊
BinaryByter
maybe he's on an architecture where logic gates are faster than assignments?
🐰🐾 سمیه
I don think so, it's a simple program
🐰🐾 سمیه
http://www.learntosolveit.com/cprogramming/Ex_5.14_sortrevnum.html
🐰🐾 سمیه
if you see any reason for that, please let me know
I_Interface
🐰🐾 سمیه
BinaryByter
yes I know
🐰🐾 سمیه
BinaryByter
and since you want to add many options
MyDear
BinaryByter
it will not set c to be the option
MyDear
BinaryByter
English only!
MyDear
MyDear
🐰🐾 سمیه
pv
I explained about the problem
BinaryByter
BinaryByter
1 is 01 in binary
BinaryByter
2 | 1 = 11
O.
hi, advice me article about concurrent code on C11 please
🐰🐾 سمیه
true, so could you explain in detail why it hasn't just set option to 1 r 2 instead of using bitwise operator?
BinaryByter
what?
🐰🐾 سمیه
I mean we could simply set values of NUMBER or DEC to option
BinaryByter
No we couldn't
🐰🐾 سمیه
why using or operator
BinaryByter
because then we would overwrite other options
BinaryByter
if we have option one and two:
your solution:
options = 1 = 01
options = 2 = 10
end result:
options = 2
My solution:
options |= 1= 01
options |= 2 = 11
end result: options = 3
🐰🐾 سمیه
so it means our program may depend in option being 3, correct?
BinaryByter
No
BinaryByter
it just means that you fill the bits
BinaryByter
a bit like you would set different elements in an array
🐰🐾 سمیه
🐰🐾 سمیه
yes
🐰🐾 سمیه
got a clue,. I'll read it in depth, if I don't undestand , I'll ask yo again. thanx
BinaryByter
#ot
🐰🐾 سمیه
is there anyone willing to give a long aswer?
S.
🐰🐾 سمیه
🐰🐾 سمیه
🐰🐾 سمیه
these two programs are almost the same. one from the book, and one the prgrame we discussed
🐰🐾 سمیه
why in the book there are two functions, one for lexicographical sort, and one for numerical sort, but in the program we talked about there isn't any function for lexicographical sort and, and still it works for that purpose?
🐰🐾 سمیه
http://www.learntosolveit.com/cprogramming/Ex_5.14_sortrevnum.html
S.
S.
strcmp is a function from the library. numcmp is implemented somewhere in the source code
S.
one of them will be fed to qsort as a pointer to function
S.
that’s all ( so what’s the question?
S.
and the declaration of strcmp is in already in the header file string.h
S.
If you’re using gcc, then strcmp is in glibc
🐰🐾 سمیه
You misunderstood me
🐰🐾 سمیه
I'm saying that, there isn't any strcmp or any other function for that purpose in the second program
🐰🐾 سمیه
And why it still works for lexicographical sorting
Anonymous
/* numeric ? numcmp : strcmp
if(numeric)
numcmp;
else
strcmp;
The program in the book has numeric value set to 0;
So it's using string compare,
But in the link you sent the numeric Value is set to 1 and the strcmp isn't even being used there. */
🐰🐾 سمیه
In this one there is strcmp
🐰🐾 سمیه
Anonymous
Read my text
Anonymous
Anonymous
🐰🐾 سمیه
Anonymous
#define numeric 1 /* numeric sort */ says it all
S.
🐰🐾 سمیه
Yes
🐰🐾 سمیه
Anonymous
numcmp is comparing strings numerically it seems.
🐰🐾 سمیه
Why don't you get me 😫