Question: I need this in c programming assignment is given and also code is given you just have to code the lines where it says TODO

I need this in c programming

assignment is given and also code is given you just have to

code the lines where it says TODO here

please edit the code that i have given and please send me screenshot of the output as well

please only edit this below code shown. any other form will not work

I need this in c programming assignment is given and also code

is given you just have to code the lines where it says

//In this assignment, we wirte code to sum up the values of the first n bytes in a memory block //that is allocated for n unsigned integers. //The memory allocation occurs in the main function //We need to implement the function sum_n_bytes //This function returns the sum of the values of the first n bytes that is pointed by //the pointer p

#include #include

//Implement the following function //The function sum_n_bytes returns the sum of the values of the first n bytes in the memory block//pointed by the pointer p unsigned sum_n_bytes(unsigned *p, int n) { //fill in your code below //Note that the sum should be an unsigned integer //This should has some ramifications on your code //Only a few lines of code expected

}

//Note how we use the command line arguments int main(int argc, char *argv[]) { if(argc != 2) { printf("Usage: %s n ", argv[0]); exit(-1); } int n = atoi(argv[1]); //allocate memory for n unsigned integers unsigned *p = calloc(n, sizeof(unsigned)); //Assign values to these unsigned integers in a certain pattern int i; for(i=0; i untitled sum n bytes.c x 1 //In this assignment, we wirte code to sum up the values of the first n bytes in a memory block 2 //that is allocated for n unsigned integers. 3 //The memory allocation occurs in the main function 4 //we need to implement the function sum_n_bytes 5 //This function returns the sum of the values of the first n bytes that is pointed by 6 //the pointer p 8 9 #include 10 #include 12 //Implement the following function 13 //The function sum_n_bytes returns the sum of the values of the first n bytes in the memory block//pointed by the pointer p 14 unsigned sum_n bytes(unsigned *p, int n) 16 17 18 //fill in your code below //Note that the sum should be an unsigned integer //This should has some ramifications on your code 19 /Only a few lines of code expected 20 21 23 25 26 27 28 29 30 31 //Note how we use the command line arguments 32 int main(int argc, char xargv[]) 34 if(argc!2) 35 36 37 38 39 printf("Usage: exit(-1) %s n ", argv[0]); intn-atoi (argv[1]); 37 38 39 40 41 42 43 44 45 46 47 48 49 exit (-1); int n-atoi (argv[1]); //allocate memory for n unsigned integers unsigned *p=calloc(n, sizeof(unsigned)); //Assign values to these unsigned integers in a certain pattern int i; for (i-0; i

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!