bool - 255 value

Posted by user994165 on Stack Overflow See other posts from Stack Overflow or by user994165
Published on 2012-10-02T21:22:59Z Indexed on 2012/10/02 21:37 UTC
Read the original article Hit count: 75

Filed under:

I have this function defined:

struct heap_validation {
    size_t num_alloc;
    size_t num_alloc_sz;
    struct memory *mem;
};
...
bool get_isallocated(struct metadata_record *);

When I call the heap_validation function from hashtable_traverse and print the result, I've gotten the following values: 0,255 ,246

void hashtable_traverse(struct metadata_record *metarec,
        struct heap_validation *heap_val) {

    printf("get_isallocated(metarec): %d\n",get_isallocated(metarec));

    bool retrieved = false;
    bool allocated = get_isallocated(metarec);
    if (allocated) {
        heap_val->num_alloc += 1;

I also tried with %d and I get the same result.

© Stack Overflow or respective owner

Related posts about c