printf("pointer: %d\n", sizeof(*void));
This line results in a syntax error because of the *. What should I do to get it to work?
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.
You are currently trying to find out the size that is at address void. If you are looking to find the size of a void pointer perhaps try: sizeof(void*) instead.
should do what you want. Use %zu and not %d as the pointer is an unsigned value and not a decimal.
Edit: Something else that I just thought of for the first time, is %zu compiler dependent? Do we need to do things differently on 32bit or 64bit architecture?