Sep 30, 2016 at 3:08am UTC
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 Sep 30, 2016 at 3:09am UTC
Sep 30, 2016 at 3:13am UTC
What does the function 'manip1' do?
Sep 30, 2016 at 3:17am UTC
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.
Sep 30, 2016 at 3:19am UTC
I'm guessing that some variable a(?) needs to output 10 somehow.
Sep 30, 2016 at 3:22am UTC
Can you post your full assignment?
What have you got by now?
Sep 30, 2016 at 3:31am UTC
Sure. But it's a lot of code.
Last edited on Oct 3, 2016 at 3:53am UTC
Sep 30, 2016 at 3:57am UTC
So what do "manip1" - "manip9" mean exactly?
If you can't explain it, they make no sense.
Sep 30, 2016 at 4:02am UTC
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
manip ulate the pointer p, so that it satisfies the assert tests.
Last edited on Sep 30, 2016 at 4:41am UTC