Can argument of sizeof operator have an expression?

Posted on 2011-03-23
Last Modified: 2012-05-11
Can I do following:

sizeof ( int * 3)

Question by:naseeam
  • 2
LVL 53

Accepted Solution

Infinity08 earned 500 total points
ID: 35199553
That wouldn't make sense, because you're trying to multiply a type with a value.

Maybe you meant :

        sizeof(int) * 3


Author Comment

ID: 35199630
You are correct!   I appreciate that!

Author Closing Comment

ID: 35199635
Very fast response.  Exactly what I needed.
LVL 40

Expert Comment

ID: 35200405
Although something like this should work...

sizeof ( 3 * 6 );

...since the result of 3 * 6 (both of implicit type int) is of type int thus the sizeof will return the size of the result type, which is an int.

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

This tutorial is posted by Aaron Wojnowski, administrator at  To view more iPhone tutorials, visit This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now