Show what will be displayed at the output from each of the following blocks of c
ID: 3812303 • Letter: S
Question
Show what will be displayed at the output from each of the following blocks of code. (a) int i = 1; int b[2][5] = {{4, 8, 1, 5, 1}, {6, 2, 3, 4, 2}}; printf ("%d", b[i] [i + 2]); (b) struct my_struct {int n; char c;} s1, s2, *p; s1, n = 4; s1.c = 'A'; s2.n = 5; s2.c = 'B'; p = &s1; printf("%d %c", s2.n, p rightarrow c); (c) int a = 6; int b = 3; printf ("%d", a & b); (d) int a [5] = {1, 4, 3, 8, 5}; int * p = &a;[1]; printf ("%d", * (p + 2)/2); (e) unsigned int a = 6; printf ("%d ", a 2); printf ("%d ", a|1); printf("%d", aExplanation / Answer
The output are as follows;:
Question 1
a. 4
b.5 A
c.2
d.4
e. 12
1
7
12
Question 2
float avg(float *a,float *b)
{
return(( a+b)/2);
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.