C Answers

Questions answered by Experts: 1 680

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Q2: Suppose you have a main() with three local arrays, all the same size and type (say



float). The first two are already initialized to values. Write a function called



sumArrays() that accepts the addresses of the three arrays as arguments; adds the contents



of the first two arrays together, element by element; and places the results in the



third array before returning. A fourth argument to this function can carry the size of the



arrays. Use pointer notation throughout; the only place you need brackets is in defining

You have to explain these instructions below with respect to the Type Systems and Type Expressions:






int number=5, d;






float m=25.5;






d=m/number;






if(number %d==0)






printf(“Divisible”);






else if(m%d)






printf(“Non-Divisible”);






else






printf(“Wrong program!”);

Write a program for the memory management.

Write a program that reads in a sequence of characters and prints them in reverse order (Use a stack).


Given an array array[], its starting position l and its ending position r. Sort the



array using Bucket Sort algorithm.



8



Input: N = 10



array[] = {10 9 7 8 6 2 4 3 5 1}



Output: 1 2 3 4 5 6 7 8 9 10

Given an array array[], its starting position l and its ending position r. Sort the array using Bucket Sort algorithm.

Input: N = 10

array[] = {10 9 7 8 6 2 4 3 5 1}

Output: 1 2 3 4 5 6 7 8 9 10 


Write a program which should consists of a user defined function “Task ()” [Function returns no 

value]. Pass 1D array to the function, along with number of elements of array. Function should delete 

the largest element from the passed array. Display the final array after deletion [After function is called] 

in the main () function


 write a program

1. Prompts the user to enter a number in the range of 1 to 255 from the keypad.

2. Waits for a user to enter a number in the range.


5.4. Using the online compiler Enter the code:

#include <stdio.h>
#include <stdlib.h>

// Function prototype. Some compilers absolutely insist that function
// prototype(s) are present
void blah2(int *i);


// ===========================================================
// Function blah2()
//
// This takes a reference to a value i, increments it and displays it
//
// Returns the calculated voltage.
// ===========================================================

void blah2(int *i)
{
    printf("In function: the value of *i is %d\n", *i);
    (*i)++;  // Equivalent to *i = *i + 1;
    printf("In function: the value of *i after increment is %d\n\n", *i);
}


int main(int argc, char *argv[]) {
    int num;
    
    num = 3;
    blah2(&num);
    
    printf("In main(): the value of num is %d\n", num);

    system("pause");
	return 0;
}


• Run the program.


Write a program that reads the numbers and sorts them by using the Counting Sort algorithm and finally search a number from that array using Linear Search Algorithm.

Input: 3 6 5 4 7 8 9

Search Item: 7

Output:

Sorted Array: 3 4 5 6 7 8 9

Search item 7 is found. 


LATEST TUTORIALS
APPROVED BY CLIENTS