BinaryByter
buy yourself two pieces of bread, put them around your head and sell yourself as a burger
BinaryByter
Anonymous
You let me feel embarrassed
BinaryByter
you know... std::string is nothing but a char array wrapped in a class
🐰🐾 سمیه
No *s is char * (the first word) **s is not a pointer any more, it's char, the first letter
🐰🐾 سمیه
But in : char *a[ ] ={ "hello", "world"} ; char **b =a; Here **b is a pointer to a pointer, which is *a, to a character, and **a is simply the first char of *a. Correct?
olli
But in : char *a[ ] ={ "hello", "world"} ; char **b =a; Here **b is a pointer to a pointer, which is *a, to a character, and **a is simply the first char of *a. Correct?
Here **b is a pointer to a pointer » No, b is a pointer to pointer to char, **b dereferences the pointer twice yielding a char which is *a » ? and **a is simply the first char of *a » yes, since *a is char* and the first char therefore is **a
olli
Have you tried running and experimenting with the code? This coul answer so many qeustions
🐰🐾 سمیه
which is *a » ? I meant that the pointer **b points to is *a, the first element of array a
🐰🐾 سمیه
then no. **b is no pointer
So what's its name
olli
So what's its name
char ? Since you dereference it twice
🐰🐾 سمیه
olli
Name of **b
in your example above **b is 'h'
🐰🐾 سمیه
So what's the diffrence between a char and char**
BinaryByter
So what's the diffrence between a char and char**
there is none, if you philosophy the right context around it
olli
So what's the diffrence between a char and char**
a char** is a pointer to a pointer to char char is a simple character char could be e.g. 'a' or 'b' char** could be any memory address such as 0x653223A0
🐰🐾 سمیه
a char** is a pointer to a pointer to char char is a simple character char could be e.g. 'a' or 'b' char** could be any memory address such as 0x653223A0
The diffrence is in their functionality, we can access diffrent elements of a string constant through a char** variable, but a char just contains a char variable?
olli
The diffrence is in their functionality, we can access diffrent elements of a string constant through a char** variable, but a char just contains a char variable?
yes a char is a character, a int is a number, a float is a floating point number Deferecing the pointer lets you access the memory at that address
olli
if you're confused by the string (char*) vs char try an example with int instead
olli
Here the pointer **b points to is *a, correct?
no - **b is still no pointer b and *b are pointers
olli
Whats the type of b ?
🐰🐾 سمیه
char **
🐰🐾 سمیه
pointer to pointer to character
olli
Yes, so what's the type of *b ?
🐰🐾 سمیه
Pointer to character
🐰🐾 سمیه
Char *
olli
Yes!
olli
so whats **b ?
🐰🐾 سمیه
It's a pointer to a pointer to character
olli
That wouldn't make any sense
olli
b => char ** *b => char *
🐰🐾 سمیه
Why
olli
there are alwats two *
olli
so **b => char
olli
It's a pointer to a pointer to character
so if **b is a pointer to pointer to character,... what's ***b then? (since you only have two levels of indirection how should you resolve a third one?)
🐰🐾 سمیه
It didn't know that also exists in C
🐰🐾 سمیه
When we declare b as follows: char **b; then b is pointer to pointer to character, besides *b which is a pointer to character is created automatically, true?
olli
When we declare b as follows: char **b; then b is pointer to pointer to character, besides *b which is a pointer to character is created automatically, true?
then b is pointer to pointer to character » Yes! besides *b which is a pointer to character » Yes! is created automatically » Well, I wouldn't say it's "automatically created". You're just looking at the memory location you're pointer points to and that's what you assign to the pointer. If you have a pointer to pointer to char and look at the memory your pointer points to, then there is a pointer to char ( Ant that shows the issues with pointers. What if it points to 0 or you're not allowed to read the address? )
Arhan
/notes
olli
Ok thanx, I think things are starting to make sense now🌷🌷🌷
sure. But srsly.. try using int instead of char. The string vs char thing might be confusing e.g. int n1[] = { 1, 2 }; int n2[] = { 3, 4 }; int *n[] = { n1, n2 }; int **pi = n; so what is pi ? What is *pi? What's **pi? Which value has **(pi + 1) ?
Arhan
Thanks
Anonymous
#callingfunction
Anonymous
interesting.
Anonymous
This animation would be very helpful for Java.
Anonymous
Actually, it'd make sense if this animation was created for Java.
Anonymous
Because of the coffee cup.
Pete
Does anyone understand this
José Manuel
#best
José Manuel
#best-book
Shahadat
Is it ok to developer an app in c++ when Java is much easier?
Shahadat
How
Ибраги́м
Many times, pointers are so confusing
Too bad C is pointer, pointer is C.
Anonymous
can i know best online wedsite to learn c
Anonymous
?
klimi
Google, stackoverflow
klimi
C documentation
Anonymous
thanks klimi
Anonymous
More like shit chat
Anonymous
Admins?
Daniele°
This best
Anonymous
thank u so much..
Anonymous
Hi
Anonymous
Which is the best Ide to use c++
olli
Which is the best Ide to use c++
Visual Studio is a great IDE. If you are not running Windows you can give Eclipse a try or use editors such as Visual Studio Code
Hayk
at least in PCs with little ram.
olli
Yeah, a great ram eater, yummy 😂
Sure, but most IDEs are.. At least Visual Studio has so many features. Even Visual Studio Code consumes tons of memory..
Hayk
VS was eating the 90% of the memory when I was trying to use it, and it was a real horror when I was trying to google sth with VS open.