Ritwik
But it prints wrong
Ritwik
Where is the mistake
Ritwik
??
Anonymous
Modulo is evil use divide
Anonymous
while(i<=500);
getch();
Are you for real? wtf?
Ritwik
Anonymous
What are you doing that for?
Anonymous
is that a do while?
Anonymous
why is there no do at the beginning?
Ritwik
Anonymous
do
{
}
while();
Anonymous
i've never seen some one use while at the end of a statement
Anonymous
while()
{
}
Anonymous
np i was just confused
Anonymous
looked like you where trying to loop getch() 500 times
Anonymous
hows it not working? the result number
Ritwik
Anonymous
Honestly I have no idea why your armstrong algo is not working, i'm not going to compile it for you atm but I suggest making print() breakpoints to output each stage of the calculation until you find the step where it goes wrong
Francisco
We really prefer a code snippet right in Telegram or a link to the code via pastebin, compiler explorer, etc
Dima
Found a good article, yeah it’s kinda old but still
https://www.gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine
Anonymous
The compiler you are using matters most but don't know where to get compiler to download.
Dima
what’s practical difference between SO_REUSEPORT and SO_LINGER?
Dima
like… docs almost identical, or I am missing something
Ибраги́м
Ибраги́м
what’s practical difference between SO_REUSEPORT and SO_LINGER?
SO_REUSEPORT (since Linux 3.9)
Permits multiple AF_INET or AF_INET6 sockets to be bound to an
identical socket address. This option must be set on each
socket (including the first socket) prior to calling bind(2)
on the socket. To prevent port hijacking, all of the pro‐
cesses binding to the same address must have the same effec‐
tive UID. This option can be employed with both TCP and UDP
sockets.
For TCP sockets, this option allows accept(2) load distribu‐
tion in a multi-threaded server to be improved by using a dis‐
tinct listener socket for each thread. This provides improved
load distribution as compared to traditional techniques such
using a single accept(2)ing thread that distributes connec‐
tions, or having multiple threads that compete to accept(2)
from the same socket.
For UDP sockets, the use of this option can provide better
distribution of incoming datagrams to multiple processes (or
threads) as compared to the traditional technique of having
multiple processes compete to receive datagrams on the same
socket.
Ибраги́м
SO_LINGER
Sets or gets the SO_LINGER option. The argument is a linger
structure.
struct linger {
int l_onoff; /* linger active */
int l_linger; /* how many seconds to linger for */
};
When enabled, a close(2) or shutdown(2) will not return until
all queued messages for the socket have been successfully sent
or the linger timeout has been reached. Otherwise, the call
returns immediately and the closing is done in the background.
When the socket is closed as part of exit(2), it always
lingers in the background.
Ибраги́м
Not So the samey
Dima
Wait.. I must have been reading the same docs lol
Daniel
Hi guys! Wtf is this?
https://github.com/RXDYE/oopLab6
I get undefined reference error when function is defined in cpp-file. When it's defined in header but OUT of the class linker see it.
Pavel
Yep, with template function/class you need to put implementation in the same translation unit (in your case in header), to let the compiler to generate the code; or to have implementation for specific types, in this case it's working like usual function/class.
🐰🐾 سمیه
BinaryByter
>compiler knows address of every local variable
are you drunk?
BinaryByter
local variable adresses aren't known at compile time
BinaryByter
neither are global variable adresses
BinaryByter
Umm
BinaryByter
this isn't a variable adress
BinaryByter
this is merely an offset
BinaryByter
Or rather: how do you know where in memory the program is loaded?
Daniel
wow. Thank you guys
BinaryByter
in this case, the global variable is an offset
BinaryByter
the linker will mark it as an offset at linkage
BinaryByter
and the kernel will fill in the gap when loading the executable
Anonymous
Hi
🐰🐾 سمیه
BinaryByter
its a variable
BinaryByter
try *(++y)
olli
n1570 - 6.3.2.1
An lvalue is an expression (with an object type other than void) that potentially designates an object; if an lvalue does not designate an object when it is evaluated, the behavior is undefined. [...]
🐰🐾 سمیه
🐰🐾 سمیه
🐰🐾 سمیه
here for ++y, I got below error. but by replacing it with *(y+1), it printed string b.
olli
Pavel
🐰🐾 سمیه
olli
and second?
does not change y and instead yields a temporary
olli
it's the same with
int x = 3;
++x; // increments x (so x is 4)
int y = x + 1; (does not change x but adds 1, so y is 5)
🐰🐾 سمیه
in case of pointers, y +1 points to the next object of its type. right?
olli
Anonymous
🐰🐾 سمیه
yes
So, why here at the above and below arrows, it walks through the elements by ++ operator?
🐰🐾 سمیه
or for example in copy fuction void copy( char *s, char *t ) for ( ; *s = *t; s++, t++);
🐰🐾 سمیه
🐰🐾 سمیه
I'm badly confused😟
Pavel
So, why here at the above and below arrows, it walks through the elements by ++ operator?
Well, this is a bit different
You have a pointer to array of three elements of type char*
In the example you've sent it's basically a char** (because the size is not given).
In the memory it will be the same thing, but compiler knows more information in your case and can prohibit you of doing some unsafe things with the pointer.
I'm not actually familiar with C-style arrays, so I may be wrong (hope I will be corrected by other uses then). But reading your code I assume that incrementing the pointer there makes no sense.
🐰🐾 سمیه
🐰🐾 سمیه
yes argv is of type cahr **
🐰🐾 سمیه
but how that explains the starnge behaviour?
Anonymous
Hey...is it possible to input elements in array by recursion and not by for loop
Francisco
Pavel
So array cannot be incremented, but you can get a pointer to the first element and increment it
Pavel
But instead you can just get elements by index, that would be much clearer way of doing the same thing :)
🐰🐾 سمیه
🐰🐾 سمیه
the argumet of main says it has to be of type char * not double star!
Ибраги́м
🐰🐾 سمیه
?
an English speaking Russain, with arabic profile. seems funny😊