#include <stdio.h> #include <string.h> main() { int i,a; char s[3],t[2]; s[0]=\'
ID: 3726065 • Letter: #
Question
#include <stdio.h>
#include <string.h>
main()
{
int i,a;
char s[3],t[2];
s[0]='B'; s[1]='c'; s[2]='';
t[0]='B'; t[1]='';
i=0; a=0;
while (a == 0)
{
if (s[i] < t[i]) a=-1;
if (s[i] > t[i]) a=1;
if (s[i] == '' || t[i] == '')
break;
i++;
}
printf("%d ",a);
a=strcmp(s,t);
printf("%d ",a);
}
answer the following questions:
last value of t[0]:
second value of a
last value of i
last value of a
First value of a
Total memory space used by the program in bytes:
answer the following questions:
last value of t[0]:
second value of a
last value of i
last value of a
First value of a
Total memory space used by the program in bytes:
Explanation / Answer
last value of t[0] is 'B'
second value of a is 1(since strcmp returns 1)
last value of i is 1
last value of a is 1
first value of a is 0
total memory is
2 int values =4bytes(2bytes each)
5char values=5bytes(1byte each)
TOTAL=9bytes depends on architecture this is general
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.