Problem with the placement of new operator

Here I submit two codes.The former one works while the other doesn't..Why?
#include <iostream>
using namespace std;

int main()
{
int * talk = new int;
*talk = 29;
cout << "The address of talk is " << talk << " and it's value is " << *talk ;
return 0;
}


#include <iostream>
using namespace std;

int * talk = new int;
*talk = 29;

int main()
{
cout << "The address of talk is " << talk << " and it's value is " << *talk ;
return 0;
}
This is an executable statement:

*talk = 29;

It must be within the body of a function or an initialization expression. It can't be just anywhere in your program code.
What exactly does an executable statement mean?
And why shouldn't it be outside the function's body?

Ps: Thanks for the reply! (:
This is a declaration/definition:

int x = 7;

Declarations/definitions can generally appear anywhere.

This is an executable statement:

x = 7;

They can only occur within expressions or as statements in a function body. Why? Because the C++ standard says so. End of story.
Is there any way to assign 'talk' as 29 directly in the line
int * talk = new int; ?
Assign, no. Initialize, yes.

int* talk = new int(29);
Topic archived. No new replies allowed.