-3

So the question in one of my assignments is: ..

A function whose signature is

int int2seq( bool* X, int8_t x );

that should extract and then store each i-th bit of x in the i-th element of array X; it should return the total number of elements stored.


my Question is What is the bool* X I've never come across it before,it sounds like a boolean value,but is it supposed to behave like an array?

Charana
  • 1,074
  • 1
  • 13
  • 26
  • 6
    `*` denotes a pointer, thus `bool*` is a pointer to boolean. You'll want to read up on pointers. Since C allows pointer arithmetic, yes, `bool*` can also be used to denote the start (or any position within) an array of booleans. – StuartLC Oct 17 '15 at 07:16
  • 1
    You should read a basic introductory to C. In particular you need to read about arrays, pointers, `bool` or `_Bool` and fixed width integer types. The `8` in `int8_t` is a hint how big the array is expected to be, but actually your teacher chose the wrong type it should merely be `uint8_t`. Voting to close because too broad. – Jens Gustedt Oct 17 '15 at 08:16

1 Answers1

1

I think you need to see this it will help you to understand bool in C. In your case bool *X pointer to bool array is what I understand. But it also can point to single variable also.

Community
  • 1
  • 1
Mohan
  • 1,871
  • 21
  • 34