Solved

Pointers

Posted on 1998-10-06
3
192 Views
Last Modified: 2010-04-01
variable type a;

What should be the variable type(say,int/char/char* etc.)so that,
a = &a =*a = same output/result?.
That is,what should be then the variablke type of a.
0
Comment
Question by:tmmet
  • 2
3 Comments
 
LVL 1

Expert Comment

by:Booth882
ID: 1174604
is this a riddle?
0
 
LVL 1

Accepted Solution

by:
Booth882 earned 0 total points
ID: 1174605
there is no general type that would accomplish this.

but if you have an int that contains a hexidecimal value equal to its address this would be true.

    int AnInteger;

    AnInteger = &AnInteger;

if you did this then your statement

    AnInteger  ==  &AnInteger  ==  *AnInteger.

would be true.
0
 
LVL 84

Expert Comment

by:ozo
ID: 1174606
a(){
    printf("%d %d %d\n",a==*a,a==&a,&a==*a);
}

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Task manager indicates my c++ program memory consumption is growing? 12 137
C++ to C# code conversion issue 4 117
Need some help with mailto 16 31
I could not set window to top 4 40
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question