Calling functions in debug mode in VC ++ (Immediate Window)

I wonder if I can call functions during debug mode in VC ++? Suppose I have a function to which I set a breakpoint when execution stops at that point during debugging, is it possible to call other functions and see their results before proceeding to the next line of code?

+5
source share
2 answers

I believe you can. I think this is called Immediate Window. I am using VS2010 Ultimate, so I don’t know if it exists in your version.

[ctrl] + [alt] + i

But this only outputs output when the function returns a value. In addition, it may not work in some cases.

, :

int number = 10; //global

int main()
{
  std::cout<<std:endl; //breakpoint 1 here
  setNumber(4);
  std::cout<<std:endl; //breakpoint 2 here
}

int getNumberSquared()
{
  return number * number;
}
void setNumber(int n)
{
  number = n;
}

1, :

getNumberSquared()

100 2 , 16

+3

Visual Studio (right click + set next statement ctrl+shift+F10), . , , , , , .

0

All Articles