Ok. Understood. Thanks a lot guys for clearing out my confusion.
Type: Posts; User: maven
Ok. Understood. Thanks a lot guys for clearing out my confusion.
Hi,
I am returning to C programs after a long time and i have confusion why 3rd output is 31! Remembering concepts of precedence and association i think i am either overlooking something or it may...
ok.
I tried it like this. Used below structure and struct "forShm" to insert in shared memory. I am able to copy data and do all. But while reading seems it is getting some garbage. I believe i...
Hi,
I have one requirement to store an array of structure at shared memory. Also the shared memory should have one counter to store number of elements in the array.
I tried to look at some...
Hence it means, code will perform perfect deep copy.
dataPtr = d.dataPtr;
i meant actually
Following are the deep copies,
a = b;
*y = *x;
For the rest, One has the error and one is shallow copy.
deep copies are, one has error and one is shallow copy!
a=b;
*x=*y;
Error will be at:
b=x;
int=int*;
In a deep copy instead of sharing same address space we use different address space for variables(pointer).
And you mean "dataPtr = d.dataPtr;" is doing deep copy!
Considering example i used. If i copy pointer like this then it is a shallow copy. whereas i asked how to do deep copy here.
exportData::exportData(const exportData& d):a(d.a),c(d.c){
strcpy(b,...
What is the context of these x and y. Are you considering these structure member variables? I am not able to relate my question with your answer!!
syntax i am aware of:
exportData::exportData(const exportData& d):a(d.a),c(d.c){
strcpy(b, d.b);
dataPtr = new dataPtr();
//After this how to make everything copy again in dataPtr, i was...
pointer is the base requirement, I can not change this. And that is why i am looking the ways to write copy constructor for this.
Hi Guys,
I have a structure and for this i want to create a copy constructor.
struct my_Export exportData
{
int a;
char b[10];
Hi,
I was looking at an old multithreaded program which is creating problem (core dump)!. The debugger tells the problem at vector.clear().
=>[1] __rwstd::__destroy<UCProfileData>(pointer =...
Only saying "not working" does not make any sense to us.
What is the error you are getting with these two.. Whether it is a compilation error or run time error?? What is the error returned? Please...
I would like to add here, If you have insert new items in the map then prefer insert() method over index overloaded operator insertion mechanism. insert() is more efficient in this case. And when you...
U have explained exact solution of the problem well, but still change of compiler is required, because of the code which is pasted has redeclaration of 'my_p_units_ptr' and 'p_price' and still user...
Are you able to compile this program, With having redeclaration of 'my_p_units_ptr' and 'p_price'! Seems some serious issues with your compiler. Change the compiler first.
When you are in main(), p is a pointer which is always pointing to the first(head) node. If you call free() for only p then only first node will be deallocated and not rest. It leads to memory leak....
fineLowest.. Lowest is fine instead of find :)
Have you searched for this file in your system! Have you googled it!
Even though not solved, look something simillar to your problem:...
The signature of strtok and c_str() is:
char *strtok(char *s1, const char *s2);
const char* c_str ( ) const;
C++ Standard does not suggest the casting as u did for first argument.
Do u know the purpose of using curly braces?
{
}
My context was for implicit default constructors.
I said "Default constructor does not INITIALIZE primitive types (POD)". This states true except when object is in static or global scope....