Now, a is local to the main function. You are trying to access it as a global variable in inc(). Try this instead:
Code:#include <iostream>
void inc(int* b)
{
*b += 50;
}
int main()
{
int a = 100;
std::cout << "a = " << a << std::endl;
inc(&a);
std::cout << "a = " << a << std::endl;
}