char firstName[32];
I understand that each char occupies 1 byte in memory. So does the above occupy 32 bytes of memory?
Am I missing a pointer that takes up memory too or is this just 32 bytes?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, that takes up exactly 32 bytes of memory.
There is no pointer.
This is often an area of confusion, since an array name silently “decays” to a “char*”
So,
firstNamemay be of typeconst char*, but it is not itself a char* variable. It is exactly like:xis int variable and takes up space.5on the other hand, is just a constant value of int type. It takes of no space; it’s just a value.