Questions tagged [sizeof]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
22 views

sizeof() syntax error with node pointer

Is there something wrong with my syntax? Won't compile, apparently because of line: sizeof(node->sprouts) / sizeof(node) above node defined as follows: typedef struct node { bool is_word; struct ...
0
votes
1answer
80 views

PSet5 Hash Tables

I was learning how to create an array of linked lists for the pset5 problem. But i keep getting a segmentation fault when I go through a character linked lists a second time. Some kind of address keep ...
0
votes
2answers
22 views

Not a problem set, but a question about the “sizeof” example from week 1 walkthroughs

I've been trying to follow along with all the examples in the walkthrough and there's something that I can't get to work and I can't for the life of me figure out WHY I keep getting this error message....
0
votes
1answer
74 views

I am getting an unexpected sizeof() error

I am using a BIT filed varibale in a struct to Modify the size of the data type. I need this struct to be exactly equals 1. According to my calculations it is equal to 10 but when I use the sizeof() ...
1
vote
1answer
198 views

Pset4 recover: can't seem to use struct to identify the jpg

Trying to apply the structs from pset4/resize. Coming up with a quick prototype to make sure i understand structs completely. 1) I keep returning nothing in my output. Can someone tell me what's ...
0
votes
2answers
106 views

Week 1, Walkthroughs_11_sizeof_recourses, program gives an error

The program instructed in the video is about usage of sizeof(). But terminal gives 4 errors which are similar; *the argument has type 'unsigned long' Any ideas on why this is happening? The program ...
4
votes
1answer
1k views

return value of sizeof()

In 'absolute beginners guide to c' chapter 13 printf("The size of in is %d.\n", sizeof(int)); but clang throws... warning: format specifies type 'int' but the argument has type 'unsigned long' [-...
0
votes
1answer
90 views

pset4, recover. size of hexadecimal 1 bit?

I don't understand something. In recover, to store the card data, I've used a buffer which is an array of 512 BYTES(i.e. uint8_t). In (almost) every element of the array is stored an hexadecimal ...
1
vote
1answer
487 views

sizeof(int) is 2 bytes in some computers, while it is 4 bytes in most modern ones. Why is it so?

What were the reasons for most computers which we work upon today to have an int of size 4 bytes? Does having a 4 byte int provide any efficiency for memory management, performance of a program?
0
votes
2answers
724 views

How Does sizeof() Work?

let suppose I have int coin[5] = {25, 10, 5, 1, 3}; printf("%i\n", sizeof(coin)); Please, I am not understanding why this is giving me an output of 20 I am still doing pset1 for the greedy ...