How can i solve 'error: cannot convert to pointer type' in c++?

Example:

int x = 10;
int* y = x;

This error occurs when trying to assign a non-pointer value to a pointer variable.

Solution:

Assign the address of a variable to a pointer.


int x = 10;
int* y = &x;

Beginner's Guide to C++