You are here:

C++/Pointer and Preprocessor doubts



I have two doubts.
1. Why the pointer to a reference is not possible.
2. How the preprocessing will occure in following code.

#define a b
#define b a

int main(void)

int a=5, b=10;


It would great help if you explain what will be preprocessed code when preprocessor reach at #define a b and what if it reaches at #define b a.


Hello Amit, thank you for the question.

1. I think you may have not sent the first part of your question. I see no code that is pointer or reference related.

2. I myself have never seen recursive preprocessing like that before. I compiled the code myself and the values remained unchanged, so I think Visual Studio may have saw that infinite recursion and left the values unchanged.

- Eddie


All Answers

Answers by Expert:

Ask Experts




I can answer questions about the C++ language, object oriented design and architecture. I am knowledgable in a lot of the math that goes into programming, and am certified by I also know a good deal about graphics via OpenGL, and GUIs.


I have completed numerous games and demos created with the C++ programming language. Currently employed as a software engineer in the modeling and simulation field. I have about 7 years experience.

©2016 All rights reserved.