carbon-lang

How to perform pointer arithmetic?


I'm new to the Carbon language, how to perform pointer arithmetic? Is this even possible?

p = p + 1;

=>

COMPILATION ERROR: <source>:11: type error in `+`:
could not find implementation of interface AddWith(U = i32) for i32*
Compiler returned: 1

Solution

  • Carbon does not support pointer arithmetic. The only two operations are

    More detail is available in carbon design notes.