Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I re - uploaded it because I wanted to hear your detailed answer. Especially, please explain in detail about number 3 . #include #include #define

I re-uploaded it because I wanted to hear your detailed answer. Especially, please explain in detail about number 3.
#include
#include
#define N 10// Line1
int main(){
unsigned char i;
char* d;
unsigned char sum =0;
d =(char*)malloc(N * sizeof(char));
for (i =0; i < N; i++)*(d + i)= i;
for (i =0; i < N; i++) sum +=d[i];
free(d);
printf("sum is %d
", sum);
}
(1)what is the value printed by the printf()statement?
(2)If #define N 100is used instead of Line1,would sum have the intended result? If not, how would you fix that problem?
(3)If #define N 1000is used instead of Line1,what problem would additionally emerge? How would you fix those problems?

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

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions

Question

09 Administer internal and external privacy policies. Knowledge of:

Answered: 1 week ago

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago