Question: /* Complete this program to understand the basic concepts in data encoding/representation and data code/type-conversion */ #include #include #include #include int main(){ int test =
/* Complete this program to understand the basic concepts in data encoding/representation and data code/type-conversion */
#include
#include
#include
#include
int main(){
int test = 0x0F; /* here is how you write decimal 15 in hexadecimal */
printf("%c ", 97); /* prints characater 'a' */
/***********************************************************
data type sizes
***********************************************************/
int max_int= 0; /* write the max int in hexadecimal notation */
int min_int = 0; /* write the min int in hexadecimal representation*/
short min_sint = 0; /* write the minimum short int in hexadecimal
representation */
short max_sint = 0; /* write the maximum short int in hexadecimal
representation */
long min_lint = 0; /* write the minimum long int in hexadecimal
representation */
long max_lint = 0; /* write the maximum long int in hexadecimal
representation */
unsigned int max_uint= 0; /* write the usigned max int in hexadecimal
notation */
unsigned short max_usint= 0; /* write the unsigned max short int in
hexadecimal notation */
unsigned long max_ulint= 0; /* write the unsigned max long int in
hexadecimal notation */
printf("max int is %d ", max_int);
printf("min int is %d ", min_int);
printf("max long int is %ld ", max_lint);
printf("min long int is %ld ", min_lint);
printf("max short int is %d ", max_sint);
printf("min short int is %d ", min_sint);
printf("max unsigned short int is %d ", max_usint);
printf("max unsigned long int is %d ", max_ulint);
printf("max unsigned int is %d ", max_uint);
assert(INT_MAX == max_int);
assert(INT_MIN == min_int);
assert(SHRT_MAX == max_sint);
assert(SHRT_MIN == min_sint);
assert(LONG_MAX == max_lint);
assert(LONG_MIN == min_lint);
assert(UINT_MAX == max_uint);
assert(USHRT_MAX == max_usint);
assert(ULONG_MAX == max_ulint);
/***************************************************
PRINT THE ASCII TABLE
*************************************************/
/* write a loop to print the ASCII table. Print 10 characters per line. Use
only one loop */
/* Sample output
! " # $ % & ' (
) * + , - . / 0 1 2
3 4 5 6 7 8 9 : ; <
= > ? @ A B C D E F
G H I J K L M N O P
Q R S T U V W X Y Z
[ \ ] ^ _ ` a b c d
e f g h i j k l m n
o p q r s t u v w x
y z { | } ~
*/
/***********************************************
WHY DOES THIS LOOP NEVER ENDS
******************************************/
/* write the reasons for that */
int k = 1;
while (k <= INT_MAX) k += k;
return (EXIT_SUCCESS);
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
