Pointer Help

Hey everyone! I'm having trouble with this pointer assignment and I was hoping that someone could help!

I have to fill in the functions that have been given to me so that they pass the tests in another file. For example, I need to fill in:
1
2
3
void manip1(Pointers* p){
  //I need to fill this in.
}


so that it passes this test when I run it:

1
2
3
4
5
void test1(){
  Pointers a;
  manip1(&a);
  assert( *(a.getA()) == 10 );
}


Any help on how I can get started would be greatly appreciated!
Last edited on
What does the function 'manip1' do?
See, that's why I'm so confused. My instructor's directions are so vague. We have to use any C/C++ code we want (using pointers) so that it doesn't fail the test1 function when it runs. I apologize if I haven't provided enough information, I was just hoping someone might be able to help me figure this out. I've been at it all day.
I'm guessing that some variable a(?) needs to output 10 somehow.
Can you post your full assignment?
What have you got by now?
Sure. But it's a lot of code.
Last edited on
So what do "manip1" - "manip9" mean exactly?
If you can't explain it, they make no sense.
1
2
3
void manip1( Pointers* p ) {
   *p->getA( ) = 10;
}


SakurasouBusters wrote:

So what do "manip1" - "manip9" mean exactly?
If you can't explain it, they make no sense.

They have to manipulate the pointer p, so that it satisfies the assert tests.
Last edited on
Topic archived. No new replies allowed.