473,396 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to do pointer typecast?

I am working on console application in visual studio 2008.
I want to read a value from console window which is of form "T_414_A" which is a macro internal to the code and is defined as some hexadecimal value. how to get that macro value?

the code which i tried is as follows:
typedef unsigned long UINT32;
typedef unsigned char UINT8;
void * text_data_vp;
UINT32 * bit_format_ref;
UINT8 Size;

printf("Enter the dynamic_data_vp value: ");
scanf("%d", &text_data_vp);
bit_format_ref = ((UINT32 *)&text_data_vp);
Size = HmStrLngTable1[*bit_format_ref];

from the value i get i need to get some other value from the "HmStrLngTable1" array?
Nov 9 '11 #1

✓ answered by johny10151981

You cannot change or set the value of a macro in runtime, because macro is processed in compile time only

4 1677
johny10151981
1,059 1GB
You cannot change or set the value of a macro in runtime, because macro is processed in compile time only
Nov 9 '11 #2
probably i think you didn't understand what i have asked. i am trying to read the name of the macro from compile and and trying to get the value of macro which i have already written in the code.
Nov 9 '11 #3
weaknessforcats
9,208 Expert Mod 8TB
The macro name is not in your compiled code. What is in your compiled code is the value of the macro.

Remember, a macro is a compile time evaluation. You source code is copied to a new file that contains the original code except the macro name is replaced by the value of the macro. This new temporary file is called a translation unit and it is this file that is compiled.
Nov 9 '11 #4
johny10151981
1,059 1GB
Thanks weaknessforcats for finding the right word
Nov 10 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: masood.iqbal | last post by:
I have a few questions regarding overloaded typecast operators and copy constructors that I would like an answer for. Thanks in advance. Masood (1) In some examples that I have seen...
8
by: Trishia Rose | last post by:
this is something ive always wondered, does it take cpu time at run time to typecast or just at compile time? for example consider the two little bits of code: int a = 5; int b = a; and: ...
9
by: Arun Prasath | last post by:
Hi all, I have the following question regd pointer typecasting. Is the following type of pointer typecasting valid? #define ALLOC(type,num) ((type *)malloc(sizeof(type)*num)) /*begin...
10
by: Kieran Simkin | last post by:
Hi, I wonder if anyone can help me, I've been headscratching for a few hours over this. Basically, I've defined a struct called cache_object: struct cache_object { char hostname; char ipaddr;...
2
by: dis | last post by:
The following code introduces a 'generic function pointer' p. When calling the pointed-to function via this p, one has to typecast p towards a pointer to the type of the pointed-to function. My...
19
by: junky_fellow | last post by:
Can the size of pointer variables of different type may be different on a particular architecture. For eg. Can the sizeof (char *) be different from sizeof(int *) or sizeof (void *) ? What...
22
by: nick | last post by:
i do not know what is the use of (e.g. void *pt), when will use it. thanks!
10
by: lovecreatesbeauty | last post by:
Why (type*)pointer isn't equal to *(type**)pointer, In the code snippet, it shows that: (int *) == (int **) , (int *) != (*(int **)) . Does type-casting change the address? or...
17
by: Christian Wittrock | last post by:
Hi, What does ANSI C say about casting an 8 bit pointer to a 16 bit one, when the byte pointer is pointing to an odd address? I have detected a problem in the Samsung CalmShine 16 compiler. This...
41
by: SRR | last post by:
Why is it discouraged to explicitly typecast the void pointer returned by malloc(); function? For example: { int *p; p = (int*)malloc(2*sizeof(int)); /*Explicit casting is done, therfore it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.