Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

    char theLetterC = 2["ABC"];
Wait, what? And I thought I was good with pointers...

Edit: I think I got it, is it this?:

"ABC" + 2 == 2["ABC"] == *(2 + "ABC")

Right?



I'm not a C man, but afaiu, "ABC" is syntactic sugar for a char pointer to that string. So it works like any pointer with regard to index access.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: