1) Initialize number 2 for integer variable num
2) Perform shift operation on num variable
3) 'The result of 1 shift operation of 2 is 4' output
4) Perform shift operation on num variable
5) '2 is shifted twice and the result is 8.' Output
2. Write a program that checks the size of the data types of 'float' and 'unsigned char' using the sizeof operator.
1) Output of 'The data type size of float is ____ bytes'
2) Output of 'Unsigned char is ____ bytes in data type'
visual-studio calculate
Studying is meaningless unless you are smart.
#include <stdio.h>
int main() {
int num = 2;
for (int i = 1; i <= 2; i++) {
printf("%d" shift %d times results in %d\n", num, i, num << i);
}
printf("float's data type size is %d bytes\nunsigned char's data type size is %d bytes", sizeof(float), sizeof(unsigned char);
return 0;
}
© 2024 OneMinuteCode. All rights reserved.