Hussein
Hussein
Saro
Saro
I think that will not that much painful.
Aquatica
Aquatica
Daulet
Hussein
What about transition from C to Go?
it is MUCH easier, maybe a little bit annoying because you are using a garbage collector instead of doing things manually, and few other stuffs but you can get used to them anyway.
In general it is almost the closest modren language to C (after lisp maybe).
frei
hello, I want to use vs code for c, I installed mingw-64, I wanted to run a code, but it gave an error, how can I fix this error?
c: The term 'c' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelli ng of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1
+ c exe.c
+~ : ObjectNotFound: (c:String) [], CommandNotFoundException
+ CategoryInfo
+ FullyQualifiedErrorId : CommandNotFoundException
Daulet
hello, I want to use vs code for c, I installed mingw-64, I wanted to run a code, but it gave an error, how can I fix this error?
c: The term 'c' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelli ng of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1
+ c exe.c
+~ : ObjectNotFound: (c:String) [], CommandNotFoundException
+ CategoryInfo
+ FullyQualifiedErrorId : CommandNotFoundException
gcc exe.c
frei
pavel
Main problems to move from C to Rust is mutability. Rust is friendly when variables most constant. But if you need an arrays of mutable variables you will have much pain to handle it
Marlo
Guys any website that i can have any exercises to learn coding? I'm studying computer science and it's my first year. Anyone that can help me? Thank you!
Pablo
Saro
Pablo
guys, I have typed nonsense things in the "prefix" area inside the pkg-config file of my project and yet it runs, why?
Saro
Pablo
void
Pablo
I think my computer has acquired intelligence
Pablo
finally
Pablo
https://prnt.sc/y88RLaWAd4-O
Babasaheb
now i study the union type,i get confused with following program, why the ch is 1,not 255 ?
Babasaheb
#include <iostream>
using namespace std;
union Port{
bool bit[8];
unsigned char ch;
} P0;
int main()
{
P0.bit[0] = true;
P0.bit[1] = true;
P0.bit[2] = true;
P0.bit[3] = true;
P0.bit[4] = true;
P0.bit[5] = true;
P0.bit[6] = true;
P0.bit[7] = true;
cout << P0.bit[0] << P0.bit[1] << P0.bit[2] << P0.bit[3] << P0.bit[4] << P0.bit[5] << P0.bit[6] << P0.bit[7] << endl;
//P0.ch = 0xff;
cout << "---->" << int(P0.ch) << endl;
return 0;
}
Babasaheb
output:
11111111
---->1
Press <RETURN> to close this window...
Babasaheb
according to the book ,the "bit[8]" array and "ch" are sharing the same memory
Ammar
Babasaheb
ok, i know why,thanks
Ammar
unsigned char ch is 1 byte in size, while your bool bit[8] is 8 bytes in size.
Part of bit takes the same place with ch. It's the first member of the array, so when you change bit[0], it's also applied to ch.
Change to bit[1] to bit[7] won't affect ch.
Babasaheb
can i manipulate every bit of ch
Ammar
can i manipulate every bit of ch
Yes, you can do something like this:
#include <iostream>
using namespace std;
union Port {
struct {
unsigned char bit0: 1;
unsigned char bit1: 1;
unsigned char bit2: 1;
unsigned char bit3: 1;
unsigned char bit4: 1;
unsigned char bit5: 1;
unsigned char bit6: 1;
unsigned char bit7: 1;
};
unsigned char ch;
} P0;
int main()
{
P0.bit0 = 1;
P0.bit1 = 1;
P0.bit2 = 1;
P0.bit3 = 1;
P0.bit4 = 1;
P0.bit5 = 1;
P0.bit6 = 1;
P0.bit7 = 1;
cout << int(P0.ch) << endl;
return 0;
}
Babasaheb
looks perfect,l love u,thanks
Anonymous
Anonymous
Ludovic 'Archivist'
Ludovic 'Archivist'
Anonymous
(as far as I know)
An implementation may allocate any addressable storage unit large enough to hold a bitfield. If enough space remains, a bit-field that immediately follows another bit-field in a structure shall be packed into adjacent bits of the same unit. If insufficient space remains, whether a bit-field that does not fit is put into the next unit or overlaps adjacent units is implementation-defined. The order of allocation of bit-fields within a unit (high-order to low-order or low-order to high-order) is implementation-defined.
Ludovic 'Archivist'
Anonymous
Ammar
Shutz
👋hello guys
Shutz
Please I need a huge help right now
Anonymous
i don't know what you say,maybe i haven't learned that😁
I didn't read the rest but if you're treating the character as an eight bit array, and you want to "turn on" the nth bit from the right, you could do
ch |= 1<<(n-1)
For example,
char ch = 0;
ch |= 1<<3;
ch will now be 00001000
Alireza
how knows about aspose word cpp
Babasaheb
Shutz
Please guys how can I code a crypter
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
Hi guys, how do I end a thread after a timeout? I have a Server that creates multiple threads in order to handle several users, and each user is given a thread. Now, if the user does not give an input after xx seconds, the thread must be shut down, the problems are:
1) I don't know how to count the passing of time in C;
2) Even if I knew, I'd need the shutdown to activate if and only if nothing has happened during the xx seconds, and therefore I would need, I think, some kind of signaling;
3) I saw some functions on stack overflow, the problem is that if I search them on the man, I get nothing, therefore I am afraid they might not be standard and, therefore, the professore might not accept the usage of such functions
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
do you have any suggestions?
urs
Hi guys I'm new to this group can anyone suggest how to learn C
urs
I just completed my 12th
Ludovic 'Archivist'
urs
Nope
urs
I have 0 knowledge about this
Ludovic 'Archivist'
I have 0 knowledge about this
The C Programming Language by Brian Kernighan and Dennis Ritchie is a good starting point, but is also insufficient. some domain specific book should be read afterwards with exercices or practical projects to work on
Ludovic 'Archivist'
I would also recommend that once you feel confident in your knowledge of C you learn another programming language that is wildly different from it, like Scheme, Elixir, Clojure...
urs
What's Brain Kernighan and dennis ritchie?
Ludovic 'Archivist'
Ludovic 'Archivist'
urs
I'm learning from w3 schools is it sufficient??
Ludovic 'Archivist'
I recommend the book, but it is a thing that exists
urs
Yes please
Ludovic 'Archivist'
Yes please
Like really, the title is The C Programming Language and Brian Kernighan and Dennis Ritchie are the authors
Ludovic 'Archivist'
They didn't name it anything original
urs
Yeah thats fine 😊
Ludovic 'Archivist'
The most important thing to learn in programming is to learn to learn. Sadly I can't think of a catchy name to write a book about that.
urs
klimi
?
As to my I don't think w3 is enough/good material if you use solely that
Babasaheb
pavel
johnNokes
Hussein
Hi guys, how do I end a thread after a timeout? I have a Server that creates multiple threads in order to handle several users, and each user is given a thread. Now, if the user does not give an input after xx seconds, the thread must be shut down, the problems are:
1) I don't know how to count the passing of time in C;
2) Even if I knew, I'd need the shutdown to activate if and only if nothing has happened during the xx seconds, and therefore I would need, I think, some kind of signaling;
3) I saw some functions on stack overflow, the problem is that if I search them on the man, I get nothing, therefore I am afraid they might not be standard and, therefore, the professore might not accept the usage of such functions
I see you are working on a server
if it is something serious you might want to use asynchronous networking
something like epoll for Linux or kqueue for BSD or Macs or a cross platform library they are all let you set timers, but libraries do it in a more friendly way
but if you insist on using threads you can use pthread_cond_timedwait