Passing a 2D array to a C++ function

There are three ways to pass a 2D array to a function: The parameter is a 2D arrayint array[10][10]; void passFunc(int a[][10]) { // … } passFunc(array); The parameter is an array containing pointersint *array[10]; for(int i = 0; i < 10; i++) array[i] = new int[10]; void passFunc(int *a[10]) //Array containing pointers { // … Read more

Why does the arrow (->) operator in C exist?

I’ll interpret your question as two questions: 1) why -> even exists, and 2) why . does not automatically dereference the pointer. Answers to both questions have historical roots. Why does -> even exist? In one of the very first versions of C language (which I will refer as CRM for “C Reference Manual“, which came with 6th Edition Unix in … Read more

What is uintptr_t data type

uintptr_t is an unsigned integer type that is capable of storing a data pointer. Which typically means that it’s the same size as a pointer. It is optionally defined in C++11 and later standards. A common reason to want an integer type that can hold an architecture’s pointer type is to perform integer-specific operations on a … Read more

how does the ampersand(&) sign work in c++?

To start, note that is a special pointer ( == memory address) to the class its in. First, an object is instantiated: Next, a pointer is instantiated: Next, the memory address of a is assigned to the pointer b: Next, the method CDummy::isitme(CDummy &param) is called: A test is evaluated inside this method: Here’s the tricky part. param is an … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)