what purpose might the they be used on systems that do have the characters other than obfuscation

well, argv points to an array of char *
so argv[0][0] has meaning

hi.

hi

;D

a pointer to a pointer is just a pointer.

:=]

T *p; what does p point at?

T?

ok
what if T is a char *?
char **q; what does q point at?

Then p points to T which is pointing to a char pointer.

;o

q is a pointer to a char pointer?

ok, so what type does q point at?

A pointer to a char.

yes — char *
so, what's the problem?

;D

When you put it like that… none.

good.

i'm still working on this little problem i contrived that i spoke of here last night — but my lack of understanding is starting to show: http://rafb.net/p/iVP58z36.html

what does *a refer to in set_structure?

Probably not what I think it does.

the only problem I can see with that function is the sizeof
oh
and a-name and a-age
what do you think it refers to?

the pointer to the address struct.

right, and what does a-name mean?

That would be looking at the pointer to the pointer of the address struct, I assume?

no, a-name means (*a).name
so if *a is a pointer, then how can you do a-name?

Umm, i'm guessing you can't?

right
so what should it be instead?

how do you get a pointer to a struct from a pointer to a pointer to a struct?

Do I have to do it the long way? *((*a).name) = "me"; ?

that's wrong still.

I suggest that you answer my question

Blast.
i'm not sure.

think. you have the knowledge already.

T **p; what type is *p?

This again…

until you've grasped it properly.

A pointer to the pointer pointing at T.

wrong.
what does *p mean?

The *value*.

no
p would give you the value of p
*p means 'the object that p points at'
T **p; what type is the object that p points at?

A pointer to T?

T *
struct foo **s;
how do you produce a struct foo *, given s?

*s = malloc (…. );?
Bugger it.

do you differ from some rare form of brain damage?
er suffer

heh

I do today, clearly.

ok, well, take it easy and try again tomorrow.
simple substitution should allow you to answer the question, though.

i'll keep going until i get it.

Only used on systems that don't have the equivalent characters on the keyboard?

well they can be used on systems that do, too.

what does *p mean?

they could be used on implementations that don't have those characters in their character set, too. the keyboard isn't relevant.

The object the p is pointing at?

substitution!

thanks for the clarification

ok, given char **p; what type of object is p pointing at?

a pointer to a char?

what purpose might the they be used on systems that do have the characters, other than obfuscation?

ok.

where you came from?

none
C differs between execution and source character sets, too.

given struct foo **x; how do you get a struct foo * through x?
the womb.

your country….

Ok, so *x points to a pointer to the struct foo… yes?

I am in korea.
ok.

aren't you american?

no, sorry — that's wrong.
x points to a pointer to the struct foo.
what does *x mean?
why would I be american?

so if x is pointing to the pointer of struct foo, then *x must point to the struct itself?

because you are impolite like americans…
are usually

are you confusing "points to" with "refers to"?

He's not being impolite, he's being very persistent.

what does *x mean?

I think i must be.

no, americans tend to scream, shout and then threaten to beat you to death.

The value pointed to by x?

object

Hell, fuck, tell to other to suffer of some rare brain damage…i call this to be impolite…

Ah, OK, object.

what type is the object point to by x?
please be quiet if you have nothing intelligent to say.

How old are you, Zhivago?

as old as my tongue and older than my teeth.

is this an answer?

yes.

struct foo **x; *x refers to the pointer to foo?

are you afraid from you age?

no.
good.

so why are you afraid to answer me?

so, how would you then access name in the struct foo * pointed at by x?
I answered you already — please be quiet if you have nothing intelligent to say.

ran79 drop it man
*ve

unfortunately I must go now — good luck.

Thank you.

I'm sure that chris can help you if you're still stuck.

x-foo-name?

yeah, I'm kinda still around
no

no, because x is not a pointer to a struct

know that x-y is (*x).y

*x points to a pointer in this case though.

*x refers to a pointer

If *x refers to a pointer, then that too must be dereferenced.

yes, certainly

*(*x)?

good, kinda.
what does **x refer to?

The struct itself.

right
so if you were using . instead of -, how would you do it?
assuming the struct has a member called name

(**x).name

yes
so given that (*x).y means x-y, how would you do it with -?

x-x-y?

no.
expand that.
x-y-z would be (x-y)-z which would be *((*x).y).z
you do not want *((*x).x).y, you want (**x).y
remember that . here only refers to struct members
still here?

Yes.

let's go back a step…
struct foo { int v; } *x;
how do you refer to v in terms of x?

(*x).v

correct
which can also be written how, using -?

x-v

right, so…
struct foo { int v; } **x;
the only difference here is you have to dereference x twice.

(**x).v

is it x–v !? :p

yep, which can also be written how, using -?
think of x-v like before, except x being dereferenced one more time.

(*x).y is to x-y as (**x).y is to ..

the key difference between (*x).y and (**x).y is that there's one more * :P

nothing wrong with using (**x).y anyway :P

x-x-v, but that can't be right.

x doesn't contain a member called x, so no

Yes.

how do you dereference x, how do you access a pointer to a struct
combine the two?

(*x)-x-v?

think.

why two xs?

well most of the time you use a struc foo **x is if you want an array so you'll write x[0]-stuff which looks easier then (**x).stuff :P

you haven't got a struct with a member called x
here's a list of parts

it's (*x)-v
do you understand why?

I think i'm beginning to.

so (*a)-age = 2; would be correct
in your example
unfortunately it's broken in other ways.

I've amended my example to use (*a)-age, but it still segfaults.
I'm assuming I've broken the malloc() bit?

the function is okay
the problem is your call
in main, you want struct address *add; then set_structure(&add);

*
To prove that you're not a bot, enter this code
Anti-Spam Image

Leave a Comment

You must be logged in to post a comment.


Blog Tags:

Similar posts: