Most voted "c++" questions
C++ is a typed, compiled, multi-paradigm, intermediate level, and general purpose programming language. It should not be confused with the language C. It was developed in the early 1980s by Bjarne Stroustrup as an extension of C. Its evolutionary features include type checking, support for automatic resource management, object orientation, generic programming and treatment of exceptions, among others.
Learn more…2,348 questions
Sort by count of
-
9
votes2
answers295
viewsOpencv haartraining - Out of memory
I have 30 positive images and 60 negative images. When I tried to run haartraining with 4GB of memory and Quadcore processor, I get this error message: OpenCV ERROR: Insufficient memory (Out of…
-
9
votes4
answers12732
viewsMultiple return in C/C++
Is it possible to return multiple values? For example: umafuncao() { int x = 1, y = 2; return x,y; } void main() { int a, b; a, b = umafuncao(); } I’m asking this question because I built a code…
-
9
votes1
answer574
viewsWhat is Explicit in C++?
I came across the term explicit being used in a C code++. What is the use of this keyword?
-
9
votes3
answers4855
viewsUsefulness of #pragma
Several C/C++ codes have the word pragma. Depending on the way it is implemented it has a different function. #pragma Once #pragma pack() #pragma comment(xx, "") For what purpose the pragma was…
-
9
votes2
answers235
viewsWhat does the _t suffix mean and when to use it?
I see in many codes some variables with the suffix _t. There are a lot of examples in the standard C library like size_t, int32_t, mbstate_t. What is the use, and when to use this suffix?…
-
9
votes1
answer325
viewsIn C++ where are the functions of the objects in memory?
In C++ when an object is declared, class variables are stored in the stack or in the heap depending on how the object was created. With the operator sizeof() it is possible to test and realize that…
-
9
votes1
answer1239
viewsWhat’s the difference between #include <filename> and #include "filename"?
Why do we use #include <filename> and #include "filename" When to use each?
-
9
votes1
answer855
views -
9
votes1
answer450
viewsWhat’s the comma for?
The comma is what? Just a language construct? An operator? Because it exists? This question is based on what was seen in How to return or extract more than one value from a function?. return base2,…
-
9
votes1
answer542
viewsWhy do we use parentheses in a pointer statement?
What is the difference between these two statements? int* array1[10]; int (*array2)[10]; Why are there parentheses in the second?
-
9
votes1
answer3505
viewsConversion to C++: What is the difference between static_cast, dynamic_cast, const_cast and reinterpret_cast?
What is the difference between casting present in the C++? There is the static_cast, dynamic_cast, const_cast and reinterpret_cast, what is the difference between these? When to use each? C++ also…
-
9
votes1
answer256
viewsWhat is an unrolling?
In this question I asked about optimization and performance that the compiler performs. Among the highlighted items, users commented that the compiler makes an optimization called loop unwinding or…
-
9
votes1
answer90
viewsWhy are there two const in the variable statement?
I can do it: const int* const objeto = &x; Why are there two const? What is the function of each?
-
9
votes7
answers65838
viewsHow to run a C program in Visual Studio Code
I’m trying to run a code (program) in C in Visual Studio Code, but I can’t find the necessary settings. I installed the C/C++ extension (Microsoft) Project structure: .vscode - c_cpp_properties.json…
-
9
votes2
answers5167
viewsWhat is "stdafx. h" and what is its importance?
When creating a C++ project in Visual Studio, it automatically brings a line into the main file: #include "stdafx.h" How I am at the beginning of the study of language, seeing some "hello world",…
-
9
votes2
answers11213
viewsIs it possible to create a C/C++ app for Android?
I want to create an application for Android using the C or C++ language. What are the advantages and disadvantages of this?
-
9
votes0
answers477
viewsHow to install and configure the Boost C++ library on Windows?
For some time I have been working hard to learn C and C++, I believe I already know enough to write a slightly more complex application using Sockets and Threads. Searching a little, I discovered…
-
9
votes1
answer191
viewsWhat does the [&] operator mean before a function?
I’m trying to read the code of a function that’s defined like this: auto loop = [&](int ntensor, char** data, const int64_t* strides, int64_t n) { ... }; What does the [&] before function?…
-
9
votes0
answers94
viewsHow to use the AWS SDK C++ Xray in a "Layer" implemented in C++ of a Lambda AWS in Python?
My team implemented a Pipeline using Computer Vision (Opencv) and a DNN (Neural Network) in Tensorflow and Keras using C++. This Pipeline is an AWS "Layer" used by a Lambda Function implemented in…
-
8
votes3
answers784
viewsSet the threads priority in C++11
In the program I’m developing I have two Std::threads that are always active throughout the life of the program. However, I consider that the role of one of them is of minor importance and would…
-
8
votes3
answers1531
viewsHow to identify heat regions in thermal images?
I’m developing a project where I need to process photos taken from a thermal camera. The idea is to try to identify fires in these images. I would like to know what techniques I can use for such a…
-
8
votes4
answers6417
viewsHow to split a string into C++?
I received this simple (I really thought it was!) challenge of creating a "tokenizer". I had to split the string " O rato roeu a roupa do rei de roma " into spaces. Then, after a long time, I…
-
8
votes3
answers9428
viewsHow does serial communication work and how do I use C/C++?
I use the Debian 7.1 and need to make serial communication between a computer and a microcontroller using C/C++. I’ve done a lot of research on the subject, but the articles and examples I found are…
-
8
votes2
answers3219
viewsC++ - Size of an array pointer
I have an array: char *exemplo[] = {"item1", "item2", "item3"}; And a function: void myFunc(**myArray) { } So, I want a function that returns the size of this array that I passed as parameter. For…
-
8
votes2
answers2694
viewsConsuming C#(dll) functions in a C/C++ project
I need to call/reuse some functions I have in a DLL, developed in C#, within a project done in C. I already looked for some things and what I managed to make it work was this project:…
-
8
votes2
answers1442
viewsHTTP requests in C++
How could I make a request in a URL that would return a json in C++? I need to access a /Return.php URL that returns the string {"status":true,"hash":"12#87!!3@WSS\/.","user":"admin"} and work on it…
-
8
votes2
answers1854
viewsCapture Computer and User name
I am developing an application and in one of its methods accurate capture the name of the computer and the user logged into the machine, then present on screen to the user. What’s the best way to do…
-
8
votes2
answers325
viewsHow to use random in C++?
I would like an example of the use of random in C++, because I need to use it but I don’t know how it works.
-
8
votes1
answer5423
viewsHow do I program for Avrs in C/C++? And using Arduino?
I’d like to know: How to start microcontroller programming ATMEL AVR in C/C++? What software can I use to compile my program? What software can I use to upload my program? Where I find the official…
-
8
votes2
answers2364
viewsJosephus problem (recursive)
This is the resolution, recursively made in C++, of josephus problem, where n is equal to the number of persons in the circle, and k is the number of step to be taken for the next person. #include…
-
8
votes1
answer521
viewsC++ with C#, is it possible?
I have a C++ project using visuals on it using wxWidgets. I was hoping to transfer the look of the project to C#. It is possible to have the programming of the functions in C++, but the programming…
-
8
votes1
answer574
viewsWhy does a char array support a character like ç and a char variable not?
Even though the char variable only supports ASCII characters, why in the following code it has the normal output when a value is inserted with characters that are not part of ASCII as accented…
-
8
votes2
answers1558
viewsDoes the passage of objects in Java simulate passage by reference?
Everyone says that Java goes by value, including Objects. These are copied and cannot be reassigned to a new object within the method. The problem is that it is possible to change object values…
-
8
votes1
answer211
viewsQT + Opencv on Mac Os 10.10.3 with error: Symbol(s) not found for Architecture x86_64
I recently installed Qt Creator and Opencv. I was able to easily compile QT and Opencv separately. But I can’t compile both together. My file .pro is like this:…
-
8
votes1
answer290
viewsManipulation of Vectors in C++
Is there a problem if I walk through one vector picking up the size of it with vector size.() and then make a for about the vector? I’m asking this question because almost every time I see…
-
8
votes2
answers1023
viewsGet Screen Resolution C++
I am developing a system and would like to know if there is any function / library, anything, to get the screen resolution, if it is for example: 1280x720, 1920x1080, 1366x768, etc... Is there any…
c++asked 8 years, 10 months ago Felipe Chiarotti 153 -
8
votes2
answers2706
viewsHow to use vector to store a class?
Example: class Nome {private: string nome; public: Nome(string nome); virtual void exibirNome() =0; }; class SobreNome: public Nome {private: string nome; public: SobreNome(string nome, string…
-
8
votes1
answer147
viewsGCC compiler command to display #ifdef
What compiler command do I use to display this line at runtime? #ifdef DEBUG double tInicio_=clock() ; #endif
-
8
votes3
answers2490
viewsWhat are the differences between pointer and reference in c++?
This question is a specific version for c++ of the question: What is the difference between pointer and reference? In practice, what are the differences between a pointer and a reference in C++? I…
-
8
votes1
answer156
viewsTo create a function equal to C# Array.Copy in C++
I would like to create a function similar to Array.Copy from C# to C++. This function has the prototype thus: public static void Copy( Array sourceArray, int sourceIndex, Array destinationArray, int…
-
8
votes1
answer1179
views -
8
votes2
answers1159
viewsIs there a C interpreter?
Everyone knows that C is a compiled language. Some know that in theory any language can be interpreted, unless it has some specification that prevents it. Are there C interpreters? They’re good for…
-
8
votes1
answer148
viewsAccess null pointer is not generating error
Testing the code below, I noticed a strange behavior. It’s working when it shouldn’t. The correct in my view was to give a segmentation failure and abort, but it seems that the compiler is doing…
-
8
votes1
answer80
viewsCan you initialize only a few members of a C array already in your definition?
I know you can do this: int a[5] = { 0, 3, 8, 0, 5 }; or int a[5]; a[1] = 3; a[2] = 8; a[4] = 5; Can you do the same in just one line, already in the definition? IE, you can initialize only a few…
-
8
votes3
answers1585
viewsHow to generate large random numbers in C++?
I’m looking to make a random number generator of [0.4], including these, only the problem is my teacher indicated that I used 4 million to generate random numbers and what value surpasses RAND_MAX ,…
-
8
votes1
answer62
viewsDo exceptions cause problems for performance?
When working in an application whose performance is important, NO USE of exceptions. With this comes doubt "what makes the exceptions so bad for performance?" In practical terms what is the need to…
-
8
votes2
answers112
viewsAbstract methods do not require implementation
I am doing a job and implemented an abstract method, the case makes a class inherit this, but the compiler does not accuse error for the lack of implementation of the methods. I’m doing it wrong?…
-
8
votes2
answers391
viewsC++ (basic): for, references and syntax
My teacher presented this function to us: void escala(std::vector<double> &v, double fator) { for (auto &vi:v){ vi *= fator; } } It serves to multiply all the elements of a vector by a…
-
8
votes2
answers828
viewsParametric polymorphism and overload in Java and C++
The following question fell in IFSP’s tender procedure: In Java and C++ programming languages, parametric polymorphism is materialized, respectively, by the functionalities and/or characteristics:…
-
8
votes2
answers105
viewsHow does an array of functions recognize the position of the next element?
Why do you ask: The question may seem strange, but is that I am a beginner in programming and at this moment I am studying pointers to function and in an example in the book by which study is…