"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
I have the basic level knowledge of pointers, arrays and recursion's.
But i it is really confusing and hard to implement in programming, like when returning a multi-dimensional array from a user-defined function to the main, and problems like that. I surfed through the net but did not get enough questions to practice these concepts neither did get any books that i can practice from.
So it would be really helpful if i can get some recommendations for the books or even websites from where i can practice.
...like when returning a multi-dimensional array from a user-defined function...
The issue you may be having is you are searching for something very specific. Broaden your search. Instead of searching for a two- or three-dimension array, just focus on arrays in general. Visually, you might look at them something like:
// one 'row' with five itemsint arr; // // three 'rows' with five items eachint arr; //  - //  - //  - // two 'levels' of three 'rows' with five items eachint arr; //  -  - //  -  - //  -  - //  -  - //  -  - //  -  - 
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
They're all pointers, and pointers are simply an address in memory.
Everyone is different, but for me, the best way to really understand a C++ concept is to write a small console program and experiment using the scientific method--that is, I hypothesize how something should work, write simple code to test that hypothesis and refine. (Sometimes, I open a disassembly view in debug mode, but that may understandably be even more confusing for many.)
Edit: A word of warning. Don't return a pointer to an object allocated on the called function's stack. While the data it points to may be valid immediately after the call, it will likely become corrupt with the next function call.
If you mean by events Windows messages, you just have to implement a message loop. But a console application does not have a window that is required as message recipient. So you can only receive messages posted to threads. See How to post a thread message to a console application[^] for an example.
Alternatively you can create a (optionally hidden) window that receives the messages. Or create a GUI application (usually dialog based) and hide the window.
Ok so the whole console now is full emulated since Windows 7 it is just a normal window.
However it has a special message handler which filters out the normal windows messages and it doesn't have a proper message queue setup. It's rather technical to go thru and add the steps to convert it when there is a much simpler way.
For the record WM_TIMERTICK and a few other windows message do get passed thru (you can use timers now on a console app) .. This will work as illustration there is a normal windows queue present on a console window however expanding the queue and removing the filter is far more problematic
So it basically does exactly what you are after you have a full windows message queue underneath and you can pump whatever message you want to the console. The actual GUI window can remain hidden by simply never setting the WS_VISIBLE flag or attaching it to the taskbar in minimized form.
Your whole app is basically a minimal hidden standard window throwing messages up to a console which is I believe what you are after.
In vino veritas
modified 4-Feb-18 19:53pm.
Last Visit: 31-Dec-99 18:00 Last Update: 1-Oct-23 16:45