question about sizeof(varible)

hi guys :) i have tow several question about size of varibles

1- is int's size takes rageter's size
2- is pointer's size the same size such int
3- is int64_t takes static size
4- let's assume this code

 
  cout<<sizeof(int);


the question is after compiling my code will my program print static number or depending on the size of current computer mens:
if my comuter the int takes 4 bytes and other computer takes 2 bytes
after compiling the code in my computer and run it in the other one will it print 2 or 4 ?
if the answter is : static size not dynamic how to fix it?
thank you :)
sizeof is always a static size that will not change after you have compiled your program.
aha thank you :)
so
1- is int's size takes register's size?
2- is pointer's size the same size such int?
3- is int64_t takes static size?
Last edited on
is int's size takes rageter's size?

I don't know what "rageter" is.

is pointer's size the same size such int?

A pointer is usually 32 bits when compiled with a 32 bit compiler and 64 bits when compiled with a 64 bit compiler but int is usually 32 bits on both.

is int64_t takes static size?

If int64_t is available then it's always 64 bits.
Last edited on
thank you so much :)
Topic archived. No new replies allowed.