To get the exact size of a type or a variable on a particular platform, you can use the sizeof operator. The expressions sizeof(type) yields the storage size of the object or type in bytes. Following is an example to get the size of int type on any machine.
Command line execution
gcc -o know_size know_size.c $ ./know_size Storage size for int : 4 Storage size for char : 1 Storage size for float : 4Implementation details
$ vim know_size.c #include <stdio.h> #include <limits.h> int main(int argc, char **argv) { printf("Storage size for int : %d \n", sizeof(int)); printf("Storage size for char : %d \n", sizeof(char)); printf("Storage size for float : %d \n", sizeof(float)); return 0; } $ gcc -o know_size know_size.c $ ./know_size Storage size for int : 4 Storage size for char : 1 Storage size for float : 4
Gotchas and common issues
Permission checks - verify user access rights and sudo privileges before executing system-level operations.
Environment configuration - double-check path variables and dependency versions to prevent runtime failures.
Backup safeguards - maintain configuration backups before applying system or database modifications.
Following these steps ensures clean configuration and reliable execution for c program to know storage size of int, char and float.
Comments and corrections