-3

I found in C code at this page:

uint16_t* terminal_buffer; 

What does it mean? Is it the same as uint16_t *terminal_buffer;? Than variable terminal_buffer is accesed like an array:

terminal_buffer[index] = make_vgaentry(' ', terminal_color);

Can somebody explain me how it works? Thanks.

Iharob Al Asimi
  • 52,653
  • 6
  • 59
  • 97
pruky
  • 1
  • 1
  • 4
    I suggest you learn the basics of the language before you attempt kernel development. –  Feb 07 '15 at 07:13
  • 2
    @pruky, when you ask whether `uint16_t* terminal_buffer;` is the same as `uint16_t *terminal_buffer;`, you are clearly showing your lack of understanding of the basics of the language. It's very likely that any answer that you get in response to your question will be hard to comprehend without a good understanding of the basics of the language. – R Sahu Feb 07 '15 at 07:18

1 Answers1

1

What does it mean? Is it the same as uint16_t *terminal_buffer;?

Yes it is, the position of the * is irrelevant if it's in between the type name and the variable name so you can write uint16_t * terminal_buffer; if you want, because spaces are ignored.

Than variable terminal_buffer is accesed like an array:

terminal_buffer[index] = make_vgaentry(' ', terminal_color);

because this is equivalent to

*(terminal_buffer + index) = make_vgaentry(' ', terminal_color);

so it's basically a pointer arithmetic operation and a dereference.

Iharob Al Asimi
  • 52,653
  • 6
  • 59
  • 97