wat is the difference b/w ponters and strings? :sad:

Member Avatar for iamthwee

wat is the difference b/w ponters and strings? :sad:

A ponter i don't no wat that is :sad:

A string is like a collection of chars

I hope this is helpful :cool:

A Pointer contains an address that points to data.
A string is any finite sequence of characters (i.e., letters, numerals, symbols and punctuation marks).

string ponter = new string;

Now we have a ponter that is a string :)

A string is any finite sequence of characters (i.e., letters, numerals, symbols and punctuation marks).

There are two types of strings -- C and C++.

A c-style string is a null-terminated sequence of characters -- certainly considerably less than infinite! That means that the string ends with the first byte that contains 0.

The C++ string is a class in std library. There are other c++ string classes too, but the standard one is in std namespace.

string ponter = new string;

Now we have a ponter that is a string :)

no its not -- it is still just a pointer, it just contains the address of a c++ class.

string ponter = new string;

Shouldn't that be

string* ponter = new string;

:?:

string ponter = new string;

Now we have a ponter that is a string :)

Sorry for dragging it...but its not even a valid code.

Shouldn't that be

string* ponter = new string;

:?:

Yup...though I have never seen or used it like this before.

Member Avatar for iamthwee

Yup...though I have never seen or used it like this before.

I think it was meant to be a joke :rolleyes:
BTW jwenting is more of a java person, so perhaps that's where the confusion came from.

no its not -- it is still just a pointer, it just contains the address of a c++ class.

In the interest of not confusing the other poster, I'd like to point out that A.D. means 'address of an object [of type string]'.

wat is the difference b/w ponters and strings? :sad:

Mr. taha umer your Question is very simple POINTER is spacial type variable it is contane memory address. And it is move memory to memory location.
your 2nd Question is about array, ARRAY is continous block of memery in cpu. the relation of pointer and arrays is. the starting indux of array have a pointer.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.