Diego
Or you could create an array of them on the stack but that's not gonna do anything with your for loop unless you initialize them manually after
Diego
The thing is always how you're going to access them later
Diego
If you use new MyObject() it'll give you back a pointer to a MyObject instance, but if you lose that specific pointer there's no way to access it later
Diego
And in C++, if you don't explicitly destroy them with delete SomePointer; they'll stay there, innacessible and taking up memory
That's a memory leak
Anonymous
As in C++ you should not use new and delete
Anonymous
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#r1-manage-resources-automatically-using-resource-handles-and-raii-resource-acquisition-is-initialization
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#r11-avoid-calling-new-and-delete-explicitly
あおい ハート
あおい ハート
wi11son
Evening guys
wi11son
Im newby to C, would love to know your opinion, if it is worth to read coreutils sources for inspiration and good example of how to write C code, or is it not the best for newbies?
klimi
My humbly opinion would be that you should try it yourself/ practice instead, but if you like reading in code, then sure, why not
Anonymous
Hey
Diego
Diego
Diego
While simultaneously working on a personal project of your own
Lubega
Hey people can you help me generate a C-programme that prints out the first even numbers
Lubega
And also another one that prints the 5 prime numbers
Lubega
Please this is urgent ,help me out
Lubega
Okay
Anonymous
I have a question please
Anonymous
If anyone help me
Anonymous
Anonymous
Lubega
Anonymous
Anonymous
plz follow the rules
Lubega
Which code exactly ???
Lubega
I'm using c compiler ,to generate all that
Anonymous
Good morning guys
Anonymous
Am new here...
Anonymous
I would like guys to help me on understanding better C/C+...
Like what should i do to be expert?
Anonymous
Anonymous
/get
Anonymous
/get cbook
Adam
/get
Adam
/get
Adam
/get
Adam
Cbook
Anonymous
Alpha Max
@vanaram007 bro if u see this meassege please come to dm🥺🥺
Harry Zhang
Sorry, posted in a wrong forum.😔
klimi
Tamah
G
Nameful
Tamah
حماد
Rukiye
Hello friends, I have a project. Could you give me some suggestions please? My project is about embedded system. I have to do it on a simulation program like Proteus but i don't know what to do. What should I do? Which simulation program I should use? How should I start?.. Thanks for any answer.
Roman
MRT
hi, i want to defination object in heap for one time and use it anywhere in the project , this is correct ? Jafar* staticJafar(){
static Jafar *jafar = new Jafar;
return jafar;
}
Anonymous
Anonymous
Create a program that will accept 10 inputs using the CIN method and store in two dimensional array using a for loop
Display the 10 value inputted in the array using for loop also
Anonymous
Help me guys please
Anonymous
MRT
Nameful
Help me guys please
This isn't a chat for doing your homework. Look up a tutorial on C++ basics
MRT
Diego
thanks
Basically make the constructor private, and add a static method that returns a pointer, like above
But the pointer being returned is, also, a static member
T* TPointer;
T* GetInstance(){
if(TPointer == nullptr)
TPointer = new T();
return TPointer;
}
Diego
Of course, TPointer would need to be private and several other details
Nameful
thanks
Singletons are generally considered bad
Rukiye
qemu
Thank you so much. Could you share a link about a Qemu embedded project?
Nils
Diego
Nils
MRT
https://stackoverflow.com/a/1008289/10149535
H
Diego
Diego
The more I read about C++ examples like these, the more I realize my C# knowledge is bleeding far too much into C++, making me think I know more than I do lmao
♧
Hello guys.
I have a problem in my program. How can i show with printf the value of scanf at the same line, with the standart library?
♧
I have to do an exam with this problem, that's why i need to know how to put the printf value directly at the same line of the scanf
Diego
Show us how you usually do it
ابراهيم
I could not setup enviorment of language (C) programming
ابراهيم
When i want to run the code it says enviorment error
ابراهيم
How i solve the prorplem
ابراهيم
🥺Please please
អង
All brother click subscribe please
Thanks
អង
Thanks
ابراهيم
Ok
អង