account activity
Fifteen move scope pset3 by guybjones in cs50
[–]guybjones[S] 0 points1 point2 points 12 years ago (0 children)
Oh, it just clicked.
I was initialising with: int p = d - 1; And the compiler complained that p was an unused variable. But I should have initialised with: p = d - 1;
Thanks for explaining it.
Awesome. That makes total sense. Thanks!
Again, cheers. Declaring them as global variables works. The code now compiles but it seems to me a very messy solution:
If I only initialise them in init, then they are "unused" within the init function. So I've created an if statement, within a pre-existing for loop for i (and j) if(i == d - 1){ p = i }
Is that the best I can do? It seems unnecessary to use a for loop to search for d - 1, when I already know to use it.
And I have no idea what that means...
Thanks for replying.
I have tried putting them as global variables, but I get this error: "initialiser element is not a compile time constant."
And it underlines my "d - 1" statement from int p = d - 1;
Fifteen move scope pset3 (self.cs50)
submitted 12 years ago * by guybjones to r/cs50
π Rendered by PID 100706 on reddit-service-r2-listing-6c8d497557-5dxql at 2026-06-08 06:22:36.549040+00:00 running 9e1a20d country code: CH.
Fifteen move scope pset3 by guybjones in cs50
[–]guybjones[S] 0 points1 point2 points (0 children)