Arithmetic on a pointer to void (looks like easy to solve but i did not understand how to do this)
Date : March 29 2020, 07:55 AM
I wish did fix the issue. How recent is your copy of ASIHttpRequest? My version looks different - there is some typecasting around that pointer arithmetic. Also, which version of XCode are you using?
|
Attempting to understand pointer arithmetic
Date : March 29 2020, 07:55 AM
I wish did fix the issue. You are incrementing the values before casting them to the wanted pointer To interpret 'c' as another pointer you should rather do printf("PTR (c+1) %p \n ",(unsigned int*)c+1);
item = (char*)heap + offset;
item = ((char *)heap) + offset
|
I really dont understand why im getting the error when creating template class shared pointer
Tag : cpp , By : Enrique Anaya
Date : March 29 2020, 07:55 AM
help you fix your problem I dont understand the error message that im getting and i have no idea how to fix that; , Your problem is in the copy constructor function: shared_pointer( shared_pointer& a)
{
a.pointer = this->pointer;
howManyObjects++;
}
shared_pointer(const shared_pointer& a)
{
a.pointer = this->pointer; // Compilation error: assignment of member ‘shared_pointer<int>::pointer’ in read-only object
howManyObjects++;
}
shared_pointer(const shared_pointer& a)
{
this->pointer = a.pointer; // Pay attention that this get the value of a, and not the opposite.
howManyObjects++;
}
|
Having trouble extending class (Dont understand whats wrong and dont understand other complex explanations on this site.
Tag : java , By : user179190
Date : March 29 2020, 07:55 AM
|
I dont understand how an arrays name is a pointer to the array
Tag : cpp , By : user176445
Date : March 29 2020, 07:55 AM
This might help you Im reading a book in c++ and I was doing some tests as I didnt understand something and when I tried printing these 3 lines I was expecting something different for all 3. The first one, the location in memory of the pointer, the second one, the address stored by the pointer, and the third one, the value at the address stored by the pointer. But instead the first two were the same: , I dont understand how an arrays name is a pointer to the array arey An array
&arey Address of the array
f(&arey) Passing the address of the array
f(arey) Still passing the address of the array (ish) - thanks a lot, C!
f(*arey) Passing the first element's value
|