Dima
Lol
MᏫᎻᎯᎷᎷᎬᎠ
About "Qt Offering Changes 2020" https://valdyas.org/fading/software/about-qt-offering-changes-2020/ https://redd.it/evb5v1 @r_cpp
Anonymous
How to open new editor window on eclipse in Linux based os?
Joesph
I didnt know I had to click add members
And my messages disappeared again
klimi
And my messages disappeared again
Oh no (in logs mat purged it)
Joesph
And who's mat?
Anonymous
Joesph
@LaurenSyme why are you leaving and joining?
Joesph
Like a loop
klimi
Kinda weird account
Joesph
Looks like fake coz she's hot
Tokin
Even that emoticon if so fakeee
klimi
Hello
klimi
Welcome David
Angelo
Does it work if I put instead mid= (l+r)/2?
Anonymous
r / 2
klimi
r / 2
Oh yes this
Angelo
Oh yes this
nope this doesn't work
klimi
It should work if it is some search
Anonymous
nope this doesn't work
It is the equivalent of r / 2 tho how
klimi
Does it work if I put instead mid= (l+r)/2?
Because you have later in the function mid -1
klimi
And mid +1
Angelo
r/2 doesn't work, because if you consider a middle interval you necesseraly need both left and right index
Tiakuh_San
Hi
Tiakuh_San
Can someone let me know how can i declare a array of integers inside a structure and give values later?
Tiakuh_San
I have a array of structs called 'all'
Tiakuh_San
Inside I have int seats[ ];
Tiakuh_San
When I try to give values all[0].seats = {1, 2 , 3} it is not accepted
Angelo
Ludovic 'Archivist'
When I try to give values all[0].seats = {1, 2 , 3} it is not accepted
You cannot assign array values in neither C nor C++ as native arrays may have heterogeneous representations (a pointer VS a memory span in your very case)
Anonymous
Does it work if I put instead mid= (l+r)/2?
No you can't because when your division is L=4 and r=8 Then m according to you will be 4+8/2 ==> 8 But actually it should be 4+(8-4)/2 ==> 6
Angelo
I wrote (l+r)/2 no l+r/2 , buy glasses
Dima
Watch your tone.
Watch your song
I_Interface
Watch your song
Only with you, dear. ❤️
Ludovic 'Archivist'
In C++ you can use std::array and std::swap to assign value
I am talking about arrays values, not std::array objects
Igor🇺🇦
I am talking about arrays values, not std::array objects
You're assigning values of one array to another. What's the difference? I don't see a reason to use C style arrays unless you need compatibility with C
Ludovic 'Archivist'
You're assigning values of one array to another. What's the difference? I don't see a reason to use C style arrays unless you need compatibility with C
Here his bug is with C style arrays so my answer is about C style arrays (array values) and pointer based arrays (constant arrays for example)
Igor🇺🇦
Here his bug is with C style arrays so my answer is about C style arrays (array values) and pointer based arrays (constant arrays for example)
That's why I asked what language does he use and if there is a need to C array. From example it seems we're talking about int[] so memcpy should work fine
Igor🇺🇦
The question was "Can someone let me know how can i declare a array of integers inside a structure and give values later?"
crt
i just did a thing
crt
struct test { int seats[3]; }; typedef struct { char bytes[3*sizeof(int)]; } twelve __attribute__((packed)); void main() { struct test t[5]; int sample[3] = { 1,2,3 }; *((twelve*)&t[0].seats) = *((twelve*)&sample); printf("%d %d %d\n",t[0].seats[0],t[0].seats[1],t[0].seats[2]); }
crt
oh lmao the compiler is adding memcpy calls to copy the bytes
Igor🇺🇦
oh lmao the compiler is adding memcpy calls to copy the bytes
Compiler doesn't add anything. It works by chance, because array that you point to exists. Try creation of array and assignment in some function and print it in main.
Tiakuh_San
Because its an array of structs
Tiakuh_San
struct Something{ int seats [5]; }all[5];
Igor🇺🇦
What do you try to show me there? This is assembly of your program : https://godbolt.org/z/HYOez2
♠️
help me with this🙏🙏🙏
Anonymous
Hello I'm studying sofware engineering.I want to learn c++ very well. So I started to trying. I need a book about C++. Do you have any suggestion? Thanks for help.
Dima
Courses are useless
Dima
Practice and practice.
Dima
Create your own pet projects
Anonymous
What about books? Should I get a book?
B
What about books? Should I get a book?
Yes books are good also check on Amazon some good books
B
Can you suggest ?
C++ Primer * (Stanley Lippman, Josée Lajoie, and Barbara E. Moo) (updated for C++11) Coming at 1k pages, this is a very thorough introduction into C++ that covers just about everything in the language in a very accessible format and in great detail. The fifth edition (released August 16, 2012) covers C++11. [Review] Programming: Principles and Practice Using C++ (Bjarne Stroustrup, 2nd Edition - May 25, 2014) (updated for C++11/C++14) An introduction to programming using C++ by the creator of the language. A good read, that assumes no previous programming experience, but is not only for beginners
deep
/sizeof
Anonymous
Hi
klimi
Hi
Hi
Anonymous
Hlo
Anonymous
How to save complex pointer struct to file
Anonymous
It is too complicated. Can I save without serialize like mmap ?
Anonymous
Any other easy function available ?
Maxi
you can cast struct to array of char and write them to file
Maxi
with reinterpret_cast
Anonymous
Please note, it is in c