Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a course in programming in C using Linux 1. Implement function ranges that takes no input and prints the ranges (i.e., the minimum

This is a course in programming in C using Linux 1. Implement function ranges that takes no input and prints the ranges (i.e., the minimum and maximum legal values) of integer types char, short, int, long, and long long, both signed and unsigned. You should do this by printing appropriate constants defined in header file located in directory /usr/include. Your output should be similar to:

signed char minimum value: -128 maximum value: 127 unsigned char minimum value: 0 maximum value: 255 signed short minimum value: -32768 maximum value: 32767 ... (and so on)

Note: The conversion instructions for signed and unsigned long are li and lu, respectively. The conversion instructions for signed and unsigned long long are lli and llu, respectively. The minimum value for unsigned integers is always 0 and therefore not defined in header file . 2. Implement the factorial function in four different ways: using a for loop in factorial1, using a while loop in factorial2, using a do-while loop in factorial3, and using recursion in factorial4. Your output for the included test code should be:

factorial1(10) = 3628800 factorial2(10) = 3628800 factorial3(10) = 3628800 factorial4(10) = 3628800

3. Implement function types that takes no input, declares 3 variables of type char, 3 of type short, 3 of type int, and 3 of type double---in that order---and prints the addresses of the 12 variables---in the same order---in both hex (use %p conversion instruction) and unsigned int format.

&a1 = 0x7fff62b73e3f, 1656176191 &a2 = 0x7fff62b73e3e, 1656176190 &a3 = 0x7fff62b73e3d, 1656176189 &b1 = 0x7fff62b73e3a, 1656176186 &b2 = 0x7fff62b73e38, 1656176184 ...

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2022 Grenoble France September 19 23 2022 Proceedings Part 4 Lnai 13716

Authors: Massih-Reza Amini ,Stephane Canu ,Asja Fischer ,Tias Guns ,Petra Kralj Novak ,Grigorios Tsoumakas

1st Edition

3031264118, 978-3031264115

Students also viewed these Databases questions

Question

1. Explain the 2nd world war. 2. Who is the father of history?

Answered: 1 week ago