#why is this wrong

12 messages · Page 1 of 1 (latest)

fervent pelican
#

codcademy wants me to point to the last element of an array (arr) so I did int* ptr = &arr[(sizeof(arr)/sizeof(arr[0])) - 1]; and I printed it out with printf("%d", *ptr); and it printed out the last number like it asked.

daring reef
#

And? what happened?

fervent pelican
#

it's still marking it as wrong

quick barn
#

Might be that they're just matching your source code against some pattern?

daring reef
#

You saying that "it's still marking it as wrong" doesn't really give much information

fervent pelican
#

I forgot you can check their solution code

#

they wanted me to just put int* ptr = &arr[9]; (the array counts 1 to 10)

quick barn
#

😂

#

i stg the "checking" on these coding courses is insane

fervent pelican
#

😂 😭