[Solved] Creating a pointer to an object without new keyword


GLFWwindow* window;
window = glfwCreateWindow( 1024, 768, "Tutorial 01", NULL, NULL);  

Look into the function glfwCreateWindow. Most likely, the function either dynamically creates an instance of GLFWwindow or points to a statically declared instance. Think of it as a similar function to new.

And to answer the title of your question, yes, you can assign a pointer to an object without using new or malloc:

static MyObject object;
MyObject *  myPointer;
myPointer = &object;

0

solved Creating a pointer to an object without new keyword