int foo[5];
What is the type of foo? You should know this.
foo is a pointer to an int array of size 5.
>>60086901
in C
>>60086901
>foo is a pointer
Whoops! Would you like to try again?
>>60086993
*foo is equivalent to foo[0]
*(foo + 4) is equivalent to foo[4]
so yes, it's a pointer.
>>60086855
"array of 5 integers"
What is the point of this thread?
>>60087041
arrays are convertibles to pointers through a standard conversion but aren't pointers.
>>60087063
>Can be dereferenced like pointers
FTFY
>>60086993
foo is an array of 5 ints.
So, of course, &foo is a pointer to an array of 5 ints.
Try runningprintf("%p %p %p %p", foo, foo + 1, &foo, &foo + 1);
>>60087109int foo[5];
foo[0] = 2;
printf("%d %p %p", *foo, foo, &foo);2 0x7ffecdb99b00 0x7ffecdb99b00
>>60087106
>I don't know what decay is
>>60086855
The type is "array of 5 int".
fcking retards
foo is pointer, array is only imaginary word
foo points to address based on [x] as foo + type * x
>>60087109
&foo is a reference
*fpointer = &foo is a pointer
>>60087235
>array is only imaginary word
wow, it's not even a real word? Look at that!
its type is
>sub esp, 5*sizeof(int)
>>60087250
Arrays are automatically passed as a ref went sent as a parameter to functions..
>>60087161
And what aboutfoo + 1and&foo + 1? In this example they should end in 9b04 and 9b14 respectively.
>>60087293
Foo+1 4 bytes
Foo+2 10 bytes
M'kay
>>60087235
Use sizeof senpai, you'll be surprised
Use vectors
>>60086855
Stop using C.
>>60087329printf("sizeof(int): %d\n", sizeof(int));
printf("sizeof(int*): %d\n", sizeof(int *));
printf("sizeof(int **): %d\n", sizeof(int **));
int foo[5];
foo[0] = 2;
printf("%d %p %p %p %p\n", *foo, foo, &foo, foo+1, &foo+1);2 0x7ffc80a982c0 0x7ffc80a982c0 0x7ffc80a982c4 0x7ffc80a982d4
>>60087442
fuck forgot the restsizeof(int): 4
sizeof(int*): 8
sizeof(int **): 8
>>60087456
I don't you did that correct
Wouldn't it make sense that a pointer is 64 bits on a 64bit arch? Int is only guaranteed to be between char and long
>>60086855
>this thread
you really need to find more interesting things to argue about
Arrays and pointers are actually slightly different in C. In C an array also has information about the number of elements if it was allocated on the stack. This allows you to use sizeof(array)/sizeof(array[0]) to get the number of elements in the array. This only works on arrays and not pointers as the size of a pointer is just whatever size your machine uses (32 or 64 bits).
>>60086855
I know it's type is int[5], but only because I saw some of the retarded sycophants on #C on freenode pitch a fit about it once to satisfy one of that channel's admins.
>>60089101
*its
fucked that up, was originally going to type "it's int[5]"...