Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Pointers

Posted on 1998-10-06
3
Medium Priority
?
196 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 85

Expert Comment

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

0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

877 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