1. Engineering
  2. Computer Science
  3. question 6 c variables and memory use reminder assume a...

Question: question 6 c variables and memory use reminder assume a...

Question details

Question 6: C Variables and Memory Use

Reminder: Assume a TM4C123 is being used unless specified otherwise.

  1. For each declaration, indicate how many bytes will be allocated in memory

i)                        long input_num2;

ii)                        int sensor_readings[10];

iii)                        unsigned short scan_data[20][40];

  1. For each, indicate the value of my_length after executing each fragment of C code. Function strlen is a standard C library function. Specify N/A if the value of my_length cannot be determined.

i) my_length is                           .

char msg[] = “CPRE288”;

int my_length = 0xFFFFFFFF;

my_length = strlen(msg);

ii) my_length is                               .          

char msg[7] = “CPRE288”;

int my_length = 0xFFFFFFFF;

my_length = strlen(msg);

iii) my_length is                             .

char msg[100] = {’C’,’P’,’R’,‘E’,‘’,‘2’,‘8’,‘8’,‘’};

int my_length = 0xFFFFFFFF;

my_length = strlen(msg);

iv) my_length is                            .  

char msg[] = {5, 7, 10, 0, 9, 2, 0, 3, 5, 77, 23};

int my_length = 0xFFFFFFFF;

my_length = strlen(msg + 4);

Question 6: C Variables and Memory Use Reminder: Assume a TM4C123 is being used unless specified otherwise. a. For each declaration, indicate how many bytes will be allocated in memory long input num2; i) unsigned short sandata20] [401; b. For each, indicate the value ofenat after executing each fragment of C code. Function steals a standard C library function. Specify N/A if the value of weheA determined cannot be char meglCPRE288 char 판gal100] { C, , , p, , , R , E , \0 , 2, , 8, ,、8 , \0 } ; int waRRrtb = 0xFFFFFFFF; char meg15, 7, 10, 0, 9, 2, 0, 3, 5, 77, 23)

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution