Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions

Question

Differentiate tan(7x+9x-2.5)

Answered: 1 week ago

Question

Explain the sources of recruitment.

Answered: 1 week ago

Question

Differentiate sin(5x+2)

Answered: 1 week ago

Question

Compute the derivative f(x)=1/ax+bx

Answered: 1 week ago

Question

Describe the nature of negative messages.

Answered: 1 week ago

Question

Compose the six common types of social business messages.

Answered: 1 week ago

Question

Describe positive and neutral messages.

Answered: 1 week ago