Question: #include #include void reality_1_example_1(); void reality_1_example_2(); void reality_3(); double fun(); typedef struct { int a[2]; double d; } struct_t; int main(int argc,char **argv) { int

#include  #include  void reality_1_example_1(); void reality_1_example_2(); void reality_3(); double fun(); typedef struct { int a[2]; double d; } struct_t; int main(int argc,char **argv) { int n; /* used to loop for reality_3() */ reality_1_example_1(); reality_1_example_2(); if (argc==1) n = 5; /* default 5 iter */ else n = atoi(argv[1]); reality_3(n); return 0; } void reality_1_example_1(){ float f=50000; int i=40000; /* fill here */ i=50000; /* fill here */ } void reality_1_example_2(){ float fx=1e20,fy=-1e20,fz=3.14; unsigned int uix=12,uiy=34,uiz=56; int six=12,siy=34,siz=56; /* fill here */ } void reality_3(int n) { double d; int i; /* fill here */ } double fun(int i){ volatile struct_t s; s.d = 3.14; s.a[i] = 1073741824; printf("fun(%d) -> %f ",i,s.d); return s.d; } /* End of file */

expected output

reality_1_example_1_float: f=50000.000000 f*f=2500000000.000000 >= 0 reality_1_example_1_int: i=40000 i*i=1600000000 >= 0 reality_1_example_1_int: i=50000 i*i=-1794967296 < 0 reality_1_example_2_unsigned: uix=12 uiy=34 uiz=56 ((uix+uiy)+uiz)=102 == (uix+(uiy+uiz))=102 reality_1_example_2_signed: six=12 siy=34 siz=56 ((six+siy)+siz)=102 == (six+(siy+siz))=102 reality_1_example_2_float: fx=1.000000e+20 fy=-1.000000e+20 fz=3.140000 ((fx+fy)+fz)=3.140000e+00 != (fx+(fy+fz))=0.000000e+00 reality_3: n=5 iterations fun(0) -> 3.140000 fun(1) -> 3.140000 fun(2) -> 3.140000 fun(3) -> 2.000001 fun(4) -> 3.140000 Segmentation fault (core dumped) $ 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!