Returning pointers of arrays and representing boolarrays as other datatypes
Hey,
I know I do not need to return a pointer in this case, but I would like to understand it, that is why I do this.
I have the following program:
Code:
#include "test.h"
#include <stdlib.h>
#include <stdbool.h>
bool** getx(){
bool* x[] = malloc(8); //create a char pointer represented by a pointer of bools...
*x[0] = true;
//do something...
return x;
}
int main(int argv, char *args[]){
bool** a = getx();
printf("%s",(a)); //Return basically the char represented by the bools
return 0;
}
So my question: how to create a pointer to an array of bools?
Kind regards,
Niclas
P.S.: If your eyes are bleeding, please note that I am a beginner. In this case, it would nice if you would offer a solution to the problem and after this, you can tell me what you would do to not encounter the problem...