Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have two questions on arrays that confuse me. The second picture is the same question as question three just with a different code. 3.

I have two questions on arrays that confuse me. The second picture is the same question as question three just with a different code.

image text in transcribedimage text in transcribed

3. (10 pts) By hand (pencil and paper) write what will be displayed upon the execution of the following C programs. If the subscripts are out of bounds or negative, write garbage value. Output: # include # include # define pi 4.0*atan(1.0) void main() { double y[] = { 0, -0.2, 0.4, -0.6, 0.8, -1.0, 1.2, -1.4, 1.6 }; printf("%1f ", y[0]); printf("%lf ", y[8]); printf("%1f ", y[9]); printf("%1f ", y[3]); y[3] = sin(pi/ 2); printf("%lf ", y[3]); printf("%lf ", y[-5]); } Output : # include # include # define pi 4.0*atan(1.0) void main() { double y[][2] = { {0, -0.2}, { 0.4, 0.6},{ 0.8, -1.0} }; printf("%1f ", y[@][0]); printf("%1f ", y[1][2]); printf("%lf ", y[9][0]); printf("%lf ", y[0][2]); y[O][2] = sin(pi/ 2); printf("%1f ", y[@][2]); printf("%lf ", y[-100][-5]); }

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

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions