Category : pointers

When I change a pointer in a Union, my other pointers break and show invalid pointer. CustomDataTypeExample Class: struct CustomDataTypeExample { float x; float y; float z; CustomDataTypeExample() = default; CustomDataTypeExample(float x, float y, float z) { this->x = x; this->y = y; this->z = z; }; // … }; ConfigCustomDataTypeExample class: struct ConfigCustomDataTypeExample { ..

Read more

I have this following function VOID printip(void *ip, THREADID tid) { PIN_GetLock(&pinLock, tid+1); fprintf(trace, "%d %pn", tid, ip); fflush(trace); PIN_ReleaseLock(&pinLock); } The pointer ip is printed in hexadecimal format, but I want to print it in integer format. So i tried the following–> VOID printip(int *ip, THREADID tid) { PIN_GetLock(&pinLock, tid+1); fprintf(trace, "%d %dn", tid, ..

Read more

vector<int> filterRestaurants(vector<vector<int>>& res, int vFri, int maxPrice, int maxDistance) { vector<vector<int>> pair; vector<int> fin; int j=0; if(vFri==1){ for(int i=0;i<res.size();i++){ if(res[i][3]<=maxPrice && res[i][4]<=maxDistance && res[i][2]==1){ pair[j][0]=res[i][0]; pair[j][1]=res[i][1]; j++; } } } else{ for(int i=0;i<res.size();i++){ if(res[i][3]<=maxPrice && res[i][4]<=maxDistance){ pair[j][0]=res[i][0]; pair[j][1]=res[i][1]; j++; } } } return fin; } the code is showing runtime error of reference poiting to ..

Read more