+ 2
Is the first character of a string also its address?
String
9 Answers
+ 2
The indexes of the array refer to the addresses if they are not dereferenced.
Run this piece of code and you'll get it.
char arr[] = "Hello";
for(int i = 0; i < 5; i++)
printf("%x\n", arr + i);
+ 1
no
+ 1
if the answer is no, what does the address of a string indicate?
+ 1
where the string is stored in memory
+ 1
So is the first character? Or the index is signed in " \0 "?
0
Or maybe there are many byte who include index?
0
the * operator represents the bits other than the value bits, so the address in memory right?
0
The name of the array, is a pointer to the first element. So if you don't dereference, you get the adress.
*(a+3) or a[3] are just different ways of dereferencing.
(That's my superficial interpretation that didn't trip me up so far and is hopefully correct enough. ;-))
0
int main () { Â Â int a [10]; Â Â float b [] = {0.12, 3.23, 1.23, 1e2, -12.43}; Â Â printf ("a has address =% x and occupies% d bytes n", & a, sizeof (a)); Â Â printf ("address of the first element =% x n", & (a [0])); Â Â printf ("bytes occupied by each element =% d n", sizeof (a [1])); Â Â return 0; }