Thanks a lot Banfa for taking time to explain in detail. Also you explained it in a way very easy to understand.
Every time I post here, I get excellent answers. I can't thank you guys enough.
Qiong
User Profile
Collapse
-
Thanks everyone and what a great post, weaknessforcats !
Now I understood
double (*balance)[6] = new double[10][6];
but still don't know what
means in C++?Code:double** balance = new double* [10];
In your article, you said
would be error.Code:double** balance = new double [10][6];
Is
equivalent...Code:new double [10][6];
Leave a comment:
-
Question about arrays and pointers, please help
I came across this when I was reading a book on Java.
In the book, there is a note trying to explain what's equivalent in C++ to
So my question is what's the difference betweenCode:double[][] balance = new double[10][6]; // Java
andCode:double balance[10][6];
andCode:double (*balance)[6] = new double[10][6];
...Code:double** balance = new double*
-
The problem is solved. Someone suggested me to add
in listnd.h before declaration of ListNode.Code:template< typename T > class List1;
And also I did the following two things:
1 took destructor ~ListNode() out of listnd.h
2. make sure all the typename (for class List1 and class ListNode) same
that did the trick.
Thank you very much for your...Leave a comment:
-
Thank you very much for your reply. I made a few changes you suggested. I put templates all in header files and I am listing them again so that it is easy to see on which lines the errors occurred.
linked-list-driver.cpp
...Code:// linked-list-driver.cpp : Defines the entry point for the console application. // //#include "stdafx.h" #include <iostream> #include "list1.h"
Leave a comment:
-
C++ How to program by Deitel and Deitel.
What kind of errors? Can you point out some of them for me? Thank you for your reply.
One thing to note again: if I remove all the templates, the program compiled successfully.
QiongLeave a comment:
-
linked list template class doesn't compile
Hi, I just recently started studying C++ and basically copied an example in the textbook into VS2008, but it doesn't compile. I tried to modify the code by eliminating all the templates then it compiled no problem. But I can't find the what the problem is with templates? Please help. The main is in test-linked-list.cpp. There are two template classes. One is List1, the other one is ListNode. The codes are below:
...Code:// test-linked-list.cpp
No activity results to display
Show More
Leave a comment: