or tag

453 questions


1 answers
133 views
0
Which one should I use, malloc or new?

In C++, there are many ways to dynamically allocate, right?Then when should I use malloc and when should I use new?malloc If you finished freeIf new is done, deleteI know I shouldn't mix the two.


1 answers
106 views
0
Do I have to call a parent class extinction?

C++ class is overriding the virtual extinctionShould I call a parent class extinction within the extinction?MyChildClass::~MyChildClass(){ //Call Parent Class Destructor this->MyBaseClass::~MyBaseC...

2 years ago

1 answers
135 views
0
&&& What is doing?

If you compile the code below into the gcc -Wall /-Waddress option,warning: the address of ‘i’ will always evaluate as ‘true’ [-Waddress]It appears.I don't know why it's coming up. I don't know what i...


1 answers
71 views
0
=! What is the operator?

!I'm asking =! not =.We didn't even assign a value in the code belowWhy is false coming out?int main(){ int a; int b = 3; return if(a =!b) { //false cout << a =! b is true! << endl; } els...

2 years ago

1 answers
80 views
0
To detect OS (OS X/Linux/Windows, etc.) on a C preprocessor?

I'm going to make a C/C++ code that supports multiple platformsYou want to determine which platform the preprocessor is using.Where can I find relevant information?


1 answers
88 views
0
Why do we use colons (:) in constructors?

I saw a code like this#include <iostream>class Foo {public: int bar; Foo(int num): bar(num) {};};int main(void) { std::cout << Foo(42).bar << std::endl; return 0;}What is written her...


1 answers
109 views
0
It's weird to compare integers with is

When running Python 2.5.2>>> a = 256>>> b = 256>>> a is bTrue # Of course it's true>>> 257 is 257True # If you compare 257 directly, it's true>>> a = 257&g...


1 answers
142 views
0
To convert a vector to an array?

vector that stores doubleI want to convert double to an array that stores it.What function should I use?

2 years ago

1 answers
113 views
0
Why does "No newline at end of file" appear?

The C++ compiler keeps saying No newline at end of file and raising the warning.Why should I enter at the end of the source/header file?It's not even an error. It's annoying and I don't feel like it. ...


1 answers
77 views
0
What does "void *p = &&abc;" do?

void *p = &&abc;I saw a code like this, but I don't know what it's doing. I've seen a lot of double pointers, but doesn't & mean the address?And you need two operands, so this isn't it.Wha...

2 years ago
« - 12 - »

© 2024 OneMinuteCode. All rights reserved.