473,789 Members | 2,898 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

difference

what is the difference between objects and pointers?
Nov 14 '05 #1
59 3578
Ramkumar R K wrote:
what is the difference between objects and pointers?


An object is 'a region of data storage in the execution environment, the
contents of which can represent values'. (Quoted from the standard.)
E.g. an integer, struct, malloced area, pointer, or whatever.
So 'int i;' declares an object (and names it 'i').

A pointer is an object which contains the address of another object (or
of a function). E.g. `int *p;'. If you set p = &i, you can access `i'
either through its name `i' or by following the pointer (with the `*'
operator): `*p'.

--
Hallvard
Nov 14 '05 #2
"Ramkumar R K" <ra********@ind iatimes.com> wrote in message
news:74******** *************** ***@posting.goo gle.com...
what is the difference between objects and pointers?


A pointer *is* an object. The difference between objects
of pointer type and those of other types, is that pointer types
are used for storing addresses, and other types store other
types of data, e.g. 'int', 'float', a user defined type
(a class or struct), etc.

-Mike
Nov 14 '05 #3
ra********@indi atimes.com (Ramkumar R K) wrote:
what is the difference between objects and pointers?


A pointer is an object, an object is not necessarily a pointer.
You can have pointer values, which are values of pointer objects, but it
makes little sense to talk of an object value (as opposed to <sometype>
value or simply value).
Pointers can point at pointers, but objects cannot object to objects.

Richard
Nov 14 '05 #4
Hallvard B Furuseth <h.b.furuseth(n ospam)@usit.uio (nospam).no> wrote:
A pointer is an object which contains the address of another object (or
of a function).


Or possibly of itself <g>.

Richard
Nov 14 '05 #5
Richard Bos wrote:

Hallvard B Furuseth <h.b.furuseth(n ospam)@usit.uio (nospam).no> wrote:
A pointer is an object which contains
the address of another object (or of a function).


Or possibly of itself <g>.


The result of the & operator, is a pointer, though not an object.

--
pete
Nov 14 '05 #6
pete <pf*****@mindsp ring.com> wrote:
Richard Bos wrote:

Hallvard B Furuseth <h.b.furuseth(n ospam)@usit.uio (nospam).no> wrote:
A pointer is an object which contains
the address of another object (or of a function).


Or possibly of itself <g>.


The result of the & operator, is a pointer, though not an object.


My hovercraft, OTOH, is full of eels - which is just as relevant.

Richard
Nov 14 '05 #7
Mike Wahler wrote:
"Ramkumar R K" <ra********@ind iatimes.com> wrote in message
news:74******** *************** ***@posting.goo gle.com...
what is the difference between objects and pointers?


A pointer *is* an object.


Not necessarily. In this code fragment:

int i;
int *p = &i;

&i is a pointer, but not an object.

--
Richard Heathfield : bi****@eton.pow ernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #8
Richard Bos wrote:
ra********@indi atimes.com (Ramkumar R K) wrote:
what is the difference between objects and pointers?


A pointer is an object,


Exceptions include the value yielded by the & "address-of" operator, and the
unadorned name of a function (which is converted to a pointer to the
address of that function, but AFAICT is not an object).

--
Richard Heathfield : bi****@eton.pow ernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #9
Richard Heathfield <in*****@addres s.co.uk.invalid > wrote:
Mike Wahler wrote:
"Ramkumar R K" <ra********@ind iatimes.com> wrote in message
news:74******** *************** ***@posting.goo gle.com...
what is the difference between objects and pointers?


A pointer *is* an object.


Not necessarily. In this code fragment:

int i;
int *p = &i;

&i is a pointer, but not an object.


AFAICT, &i is an expression with pointer type, evaluating to a pointer
value, but p is the only pointer.

Then again, it's a pain to search a document for the definition of
"pointer, but not pointer type or pointer value or object of pointer
type", but the C99 Standard _seems_ to use "pointer" both in contexts
where it must mean "a value of a pointer object" (conversion) and in
contexts where it must mean "an object of pointer type" (increment), so
if _they_ don't have to be consistent about it, I don't see why we
should.

Richard
Nov 14 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

34
7112
by: yensao | last post by:
Hi, I have a hard time to understand difference and similarities between Relational database model and the Object-Oriented model. Can somebody help me with this? Thank you in advance. Yensao
21
3022
by: b83503104 | last post by:
Hi, Can someone tell me the difference between single quote and double quote? Thanks
26
4422
by: Frank | last post by:
For my website i would like to display the age of my son in years, months, days and hours. For now i manage to get a result for totals. Like the total number of days. This is the beginning: starttime = Date.parse("Aug 10,2003, 07:07") sdt = new Date(starttime)
21
2853
by: Rich | last post by:
I was considering C# for developing a scientific application, but I have noticed a ~30% difference between VC++ .NET and C# on the same machine, under identical conditions: double a = 0,b = 0, c = 0, d = 0, e = 0; for(int n = 0; n != 6000000; n++) { a = n % 5 *2 / 3 - 4 + 6 / 3 - n + n * 2; b = n * 2.3 - 1 *2 / 3 - 4 + 6 / 3 - n + n * 2; c = n * 3 / 3.5 *2 / 3 - 4 + 6 / 3 - n + n * 2;
4
15759
by: jamesyreid | last post by:
Hi, I'm really sorry to post this as I know it must have been asked countless times before, but I can't find an answer anywhere. Does anyone have a snippet of JavaScript code I could borrow which calculated the difference in years and days between two dates, and takes leap years into account? I'm calculating the difference in the usual way, i.e....
3
4163
by: bbawa1 | last post by:
Hi, I have a table which has a field ItemsReceived of type datetime. I have a grid view which has two columns. In first column i have to show the data from field ItemsReceived and in second column I have to show difference between Currenttime and date from ItemReceived. How can I do that.
12
2716
by: Petronius | last post by:
Hallo, does anyone have an idea how to implement difference lists in Javascript? Thanks allot in advance
5
3489
by: Julius | last post by:
Hej dudes, I need to calc the difference between two timestamps / dates ... For example what i need to calculate: Date 1: 2007.11.06 - 20:13:04 Date 2: 2007.11.07 - 21:13:04 Difference: 1 day, 1hour
9
2681
by: viki1967 | last post by:
Hi all! This new forum its great! :) Congratulations !!! My answer: why this my code not working? Nothing error but not work the difference.... : <html>
11
12126
by: cmb3587 | last post by:
I have two arrays and I'm trying to create a 3rd array that is the difference between the two arrays Ex: arrayA: 3 5 8 9 arrayB: 3 4 6 9 difference of A-B: 5 8 however, my code is just returning me an array of 0's
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9020
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.