Question: 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

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!