Dany77
Dany77

Reputation: 21

is the "char *" type an address?

I know that:

char * pword;  

declares a table which first element is used as a pointer.
And

*pword <=> * (&pword[0]) <=> pword[0]  

(Tell me if I'm wrong.)

But what I want to know is if char* is a type (as int is for integers) and if yes does it represents an address?

Upvotes: 0

Views: 137

Answers (2)

Emil Vikstr&#246;m
Emil Vikstr&#246;m

Reputation: 91983

Yes, char* is a type, and a variable of that type represents a memory address for a char-type variable (formally a "pointer to char"). The C data types article on Wikipedia is a good introduction of the various types.

Upvotes: 1

Vbp
Vbp

Reputation: 1972

*pword <=> * (&pword[0]) <=> pword[0] 

you are correct here.

C provides the char type variable, in your case pword is a pointer to char type. Also, a character string is stored in an array of character type, one ASCII character per location.

Upvotes: 0

Related Questions