![]() ![]() So always use %d format specifier to show the size. ![]() What is the size? The size representation is always in the form of integers. Then I print the size of these two variables using the sizeof function. C and the second one is of type short i.e. ![]() In the above program, first, I am declaring two variables. Printf("size of float : %d bytes(s)\n", sizeof(float)) Printf("size of short : %d bytes(s)\n", sizeof(S)) Printf("size of char : %d bytes(s)\n", sizeof(C)) ![]() Please have a look at the following example which uses the predefined sizeof function. Predefined sizeof function example in c language: For better understanding, please have a look at the following diagram. So, if you want to find out the size of any data type, we can go for a sizeof function. The sizeof function is a predefined function and that will return the size of different types of things. So, we can pass either variable, data type, expression, or pointer as an argument to the sizeof function. So, what are the different things? The sizeof function returns the size of the following four things. The sizeof function in C Language is used to return the size of different things. The sizeof function is a predefined function just like the printf and scanf() functions. Data Structures and Algorithms Tutorials. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |