Pointers in C++ |
| |
 |
Reputation Power: 1

| | New Coder Posts: 24 Topics: 21 |
|
|
July 24, 2009, 03:22:59 AM
|
Well, besides pointers in C++ most of the java objects are similar to that of C++. Java programming doesnot have pointers. In C++, the two basic things of pointers are & referrence operator and * operators. It is related to the address or memory location to a variable.
|
|
|
|
| |
 |
Reputation Power: 17

| | Code Guru Gender:  Posts: 1403 Topics: 86  |
|
|
July 24, 2009, 03:28:18 AM
|
Java programming doesnot have pointers.
Arguably Java does have pointers - it is just the programmer is hidden from them somewhat and can not do interesting things such as pointer arithmetic. For instance, in Java String mystring=new String("Hello"); The variable "mystring" points to the string object containing characters Hello, at a lower level of abstraction it points to the memory holding this string just like C++, you can even repoint this by mystring=new String("a new string"). The automatic garbage collector in Java will then recognise the original string is no longer being pointed to and hence of no use and will free the memory for some other usage.
|
|
| |
 |
Reputation Power: 1

| | Regular Coder Posts: 53 Topics: 2 |
|
|
August 03, 2009, 09:20:39 PM
|
It's not arguably, Java does have pointers. I'm tired of people saying it doesn't. They're there. They're a pain because you can't touch them. It's misleading to say they aren't there, because almost every variable in Java is a pointer.
|
|
| |
 |
Reputation Power: 17

| | Code Guru Gender:  Posts: 1403 Topics: 86  |
|
|
August 04, 2009, 04:15:21 AM
|
It's not arguably, Java does have pointers
Depends on the programmer's level of abstraction Almost every variable in Java is a pointer.
Apart from the primitives 
« Last Edit: August 04, 2009, 04:30:48 AM by polas »
|
|
| |
 |
Reputation Power: 1

| | Regular Coder Posts: 53 Topics: 2 |
|
|
August 04, 2009, 07:02:59 AM
|
This is why I say almost.
The biggest annoyance to me in Java is the inability to overload operators. I want == to work for strings, I don't want to have to use .equals(). I think it's just something that I'm accustomed to being able to take advantage of and when I don't have it I feel like I'm being restricted.
|
|
| |
 |
Reputation Power: 17

| | Code Guru Gender:  Posts: 1403 Topics: 86  |
|
|
August 04, 2009, 07:13:08 AM
|
This is why I say almost.
I know  The biggest annoyance to me in Java is the inability to overload operators. I want == to work for strings, I don't want to have to use .equals(). I think it's just something that I'm accustomed to being able to take advantage of and when I don't have it I feel like I'm being restricted.
Yes I agree it would be very helpful (== checking pointer equality rather than value equality of objects has often confused the students I have taught a great deal) I can see how from a C++ background that would be a major want for the language. Personally, as C programmer and being in that mindset, I often find myself writing Java and thinking "if only I could use pointer arithmetic I could save myself so much time, effort and the code would be very elegant" Oh well, I suppose we can not have everything!
|
|
| |
 |
Reputation Power: 17

| | Code Guru Gender:  Posts: 1403 Topics: 86  |
|
|
August 01, 2010, 05:48:01 AM
|
Function pointers also exist within C....
|
|
| |
 |
Reputation Power: 1

| | New Poster Posts: 2 Topics: 0 |
|
|
August 01, 2010, 08:50:49 PM
|
Pointers do not have a default value in C/C++. They are called wild! It means that they point to some unknown random location, and if it is for example an integer pointer (int*), it is not even guaranteed the the location pointed to by a pointer initially is occupied by an integer data.
« Last Edit: August 28, 2011, 05:38:25 AM by Admin »
|
|
| |
 |
Reputation Power: 1

| | New Coder Posts: 15 Topics: 0 |
|
|
March 09, 2011, 12:40:28 PM
|
C + +, the pointer is a variable that stores the memory address. Each store has an associated storage location address. Pointer is a variable, which holds the address, also called a pointer variable. C + + programmers are forced to work in the pointer, so they used a pointer to their code.
dell coupons codes
|
|
| |
 |
Reputation Power: 1

| | New Coder Posts: 18 Topics: 0 |
|
|
March 14, 2011, 11:50:48 PM
|
Pretty useful post,, left me asking for more!!. .
|
|
| |
 |
Reputation Power: 2

| | Skilled Coder Posts: 125 Topics: 0 |
|
|
March 15, 2011, 01:59:16 AM
|
Yes, Pointer is a very powerful of the C++ language that has many uses in advanced programming. There are main two operator in pointer, Which are given below.
- Reference Operator(&). - Dereference Operator(*).
|
|
| |
 |
Reputation Power: 1

| | New Coder Posts: 20 Topics: 0  |
|
|
March 18, 2011, 12:24:03 AM
|
We could probably use a few more pointers that discuss more specific issues. Repetition is the key to learning. So long as the information is accurate, I have no problem with some redundancy.
|
|
| |
 |
Reputation Power: 1

| | New Coder Posts: 20 Topics: 2 |
|
|
April 13, 2011, 02:12:15 PM
|
The variable "mystring" points to the string object containing characters Hello, at a lower level of abstract entity it points to the memory holding this string just like C++, you can even point this by mystring=new String
|
|
| |
 |
Reputation Power: 1

| | New Coder Posts: 25 Topics: 1  |
|
|
April 20, 2011, 09:01:25 PM
|
Pointers are there in C# but they are not used because they can point to location which is out of CLR. same MAY BE CASE WITH jAVA
|
|
| |
 |
Reputation Power: 1

| | New Coder Posts: 25 Topics: 2 |
|
|
April 26, 2011, 12:44:55 PM
|
Drinkable programming doesnot bang pointers. In C++, the two commodity things of pointers are & referrence opportunist and * operators. It is affine to the come or memory activity to a multivariate.
|
|
| |
 |
Reputation Power: 1

| | New Poster Posts: 6 Topics: 0 |
|
|
May 03, 2011, 04:55:31 PM
|
Pointers are a part of C++ programming that can cause grief though not as much as in C, where to do anything non trivial you have to use pointers. It is a capricious that is used to store a memory address Pointers are not that bad, but if you are new to them they will could could cause you troubles. It is all to simple to address bad code with pointers.
|
|
| |
 |
Reputation Power: 2

| | Skilled Coder Real name: Janne Location: california
Gender:  Age: 26
Posts: 108 Topics: 1  |
|
|
May 03, 2011, 10:20:53 PM
|
A pointer is a variable that is used to store a memory address. The address is the location of the variable in the memory. Pointers help in allocating memory dynamically. Pointers improve execution time and saves space. Pointer points to a particular data type. The general form of declaring pointer is:-
type *variable_name;
|
|
| |
 |
Reputation Power: 1

| | New Poster Posts: 5 Topics: 0 |
|
|
May 10, 2011, 03:00:10 AM
|
The following is a simple example of the use of pointers. . .
int &variable1Label = variable1; variable1Label = 101; cout << "The value of integer1 after assigning a value " << "to the label is now: " << variable1 << endl << endl;
I'm not really understanding it, though. How does it actually work? I have referred to the tutorial on this site, but am still unsure.
« Last Edit: May 10, 2011, 08:16:30 PM by Admin »
|
|
| |
 |
Reputation Power: 1

| | New Coder Posts: 19 Topics: 1  |
|
|
May 27, 2011, 04:35:22 AM
|
every variable in java is a pointer
|
|
| |