|
From: Wobien <roo...@pl...> - 2008-01-07 22:06:59
|
&ulRandomNum is the adress of ulRandomNum (You don't give us the definition
of it, so don't know what it is)
(char *) is a cast. It makes the adress of ulRandomNum be read as a char
array. So ((char *) &ulRandomNum) [nIndex]
will give you a byte of the binary code of ulRandomNum.
Wobien
----- Original Message -----
From: "Szentpali Janos" <ia...@ea...>
To: <dev...@li...>
Sent: Monday, January 07, 2008 6:32 PM
Subject: [Dev-C++] Translation
Hi,
I am very new to C++. I only did VB programming... mostly. I am having
some trouble with some C++ code. Could someone help me understand what
the following means:
--- start ---
typedef DWORD(*FUNCPTR)(BYTE);
DWORD ulWorkRandomNum;
char *arr;
int nIndex;
...
arr [2 * nIndex] = 'A' + (((char *) &ulRandomNum) [nIndex] & 0x0f);
--- end ---
I am having trouble with "translating" (understanding) the
((char *) &ulRandomNum) [nIndex]
part. I mean [nIndex] referes to the elemnt of which array :O
--
Szentpáli János
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|