This is probably a stupid question, but I don't understand why this works:
int** test = new int*[7];
int x = 7;
*(test+1) = &x;
cout << (**(test+1));
test is a pointer to a pointer right? The second pointer points to the array, right?
In my understand I would need to dereference the "test" pointer first to get to the pointer tha...
How to create a bulleted or numbered list in QTextEdit with Qt by clicking a button? Also it is necessary that make a list the paragraphes which are selected by clicking the same button. And when the cursor is in the list and you click the button, the the list item becomes not-list item, but a simple paragraph. In two words I want to cr...
I'm not sure what programming in C really means:
- Programming in pure C with a C compiler
or
- programming in C with a C++ compiler.
Apart from the differences between the C's syntax of C and the C's syntax of C++, can I safely say there are absolutely (or in very few cases) no differences between two executables in terms of performanc...
With reference to the SO thread C Macro Token Concatenation involving a variable - is it possible?,
Is it at all possible to generate variable names at compile-time in C and C++?
something like
int count = 8;
for(i=0; i<count; i++) {
int var_%i% = i*i; // <--- magic here
}
I know I can use arrays for this case, but this is jus...
Hi,
I need to maintain a list of vector(int), vector(char) and vector(float). Is this possible?
...
Why can't we create object in QT without the new keyword? Usually we create pointer to an object, like this:
QLabel *ql=new QLabel(); ql->show()
But I want to create an object like this:
QLabel ql=QLabel(); ql.show()
Is it possible?
...
Hello.
I have written an application in VS C++ 2010 Express Edition which consists of some DLLs and also depends on some third party DLLs.
The application itself is a DLL.
As it turned out, to make it work on another machine, user has to install VS 2010 redistributable runtime.
I tried to build my DLL with flag /MT instead of /MD - ...
hello!
Whats the most simple way (without much fancy stuff and no big setup overhead) to create a c++ project with visual studio where i can create some graphical debug output? (mainly drawing some lines, circles and triangles in a window. doesn't have to be performant or look pretty)
thanks!
...
i have following code to implement ADT of polynimial class
#include <iostream>
#include <cstdlib>
using namespace std;
template<class Number>
class POLY
{
public:
int n;
Number *a;
public:
POLY<Number>(Number c,int N){
a=new Number[N+1];
n=N+1;
a[N]=c;
for (int i=0;i<N;i++) a[i]=...
i tried to look up whether virtual function determine during compilation or while running.
while looking i found something as dynamic linking/late binding
but i didn't understand if it means that the function itself determine during compilation before the executable or during the executable.
can someone please explain?
...
VIDEOINFOHEADER *pVih = (VIDEOINFOHEADER*)pmtConfig->pbFormat;;
...
WriteFile( hHandle, pVih, sizeof(VIDEOINFOHEADER), NULL, NULL );
Through debugging I found WriteFile reports exception, how to solve it?
...
Iam a beginner in C++ language (2 years ago i starting to learn it) and now my friend that has a good skill in Java said me that 'learn Java Its better than C++' I said 'why' and she said 'Java is easy than C++ , java is speedy than C++ , java has a better Labor market and ...'
please help me which language is better ? Java or C++ ?
Th...
I am trying to print into a file in C++ and for some reason I keep getting this weird error:
error C2061: syntax error : identifier
'ofstream'
I included the following:
#include <fstream>
#include <iostream>
This is my function:
void Date::PrintDate(ofstream& resultFile) const
{
resultFile << m_day << "/" << m_month << "/...
Hi,
I noticed that when linking boost libraries in VS2010, I only need to specify the linking directory, and the compiler automatically selects the right libary to link.
How can I do the same with my libraries?
...
Can you please advice with an example of using SoapRMI-C++ to send/receive objects between C++(top) and Java(bottom) layers of an application.
Please let me know its feasibility and implementation complexities.
Thanks,
Gtk
...
This is for the C preprocessor experts:
How can I declare an enum with a list of some identifiers and later during the switch-statement check if an identifier was included in the list?
Example of what I need:
typedef enum { e1, e2, e3, e4, e5, e6 } e;
e x;
switch (x) {
#if DECLARED_IN_ENUM (e1)
case e1 : ...
#endif
/* etc. */
}
...
I have trouble implementing my class. It should be able to initialize from std::string. So I wrote a copy (?) constructor:
CVariable (std::string&, const int p_flags = 0);
I'm trying to make an object of CVariable:
MCXJS::CVariable s_var = (string)"good job";
I'm getting the following error:
F:\Projekty\MCXJS\src\main.cpp|8|error:...
I get the error assignment makes pointer from integer without a cast on the following code, what does it mean?
char * splitter;
if(splitter = strchr(key, ':') != NULL && *(splitter + 1) == ' ')
...
I'm making a 3D game with OpenGL that basically has a world made entirely of AABB cubes. I created this to make 24 verticie cubes:
void CBox::UpdateDimensions( float w, float h, float d, Vertex3f c )
{
width = w;
height = h;
depth = d;
center = c;
Vertex3f verticies[24];
GLfloat vboverticies[72];
GLfloat vbo...
I had a discussion with Johannes Schaub regarding the keyword inline.
The code there was this:
namespace ... {
static void someFunction() {
MYCLASS::GetInstance()->someFunction();
}
};
He stated that:
Putting this as an inline function may
save code size in the executable
But according to my findings here and ...