User Profile

Collapse

Profile Sidebar

Collapse
jfsd
jfsd
Last Activity: Aug 22 '08, 07:06 AM
Joined: Aug 22 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • jfsd
    replied to Void reinterpret cast question
    in C
    Thanks for the hint. Changing the line to this makes it work:
    Code:
    int* xp = reinterpret_cast<int*>(v);
    See more | Go to post

    Leave a comment:


  • jfsd
    started a topic Void reinterpret cast question
    in C

    Void reinterpret cast question

    Hello, I have got a question, in the following code:

    Code:
    void func(void* v, int n, int val) {
        int* xp = reinterpret_cast<int*>(&v);
        for(int* i=xp; i<xp+n; i++)
           *i = 5;
    }
    int main() {
        int array[10];
        func(array, 10, 5);
    
        for (int j=0; j<10; j++)
            cout << array[j] << endl;
    }
    When passing the array...
    See more | Go to post
No activity results to display
Show More
Working...