What is the ouput f the following code #include void fun (int *ptr) { --pt; } int main() { int y [] = {1,2,3}; fun (&y[1]); printf("%d",*(y+1)); return 0; } a. Undetermined value b. 1 c. 2 d.3
Q: y = -x2 + 3 x + 4 – 1<x <4 at Ax = 1 d. Write a function for the following equation using f(x) in…
A: So here we are asked to write a program in C++ to sort the values of X in increasing order using…
Q: Assume that LA is not empty of n size. Write a C program that will define the task of the function…
A: I have provided C CODE along with CODE SCREENSHOT and also provided TWO OUTPUT…
Q: Evaluate the given C Program codes: With the given statement, int values[]={1,2,3,4,5,6,7,8,9,10};…
A: The main objective of the program is to perform certain tasks according to the instructions provided…
Q: 4. Given two unsorted arrays of integer numbers, write a function which returns number of elements…
A: Program: Programs contain the general instruction given to the computer to perform certain tasks.…
Q: Write a C++ program that will prompt the user for the size of a list of integers. Your program will…
A: The Answer is
Q: Write a C++ function (call it index_max) that finds the maximum number in the array, that is passed…
A: We need to write a C++ code for the given scenario.
Q: Provided below is the C implementation of the quick sort sorting algorithm. Modify it, so that low,…
A: #include <stdio.h>#define N 10/* Function prototypes */void quicksort(int* low, int*…
Q: Question 4 We consider the the following code: #include using namespace std; void add(int i, int…
A: Here in main() function A=1 B=2 C=3 D=1.1 We call add(A,B); => add(1,2) void add(int i,int…
Q: What are the use cases for using the arrays and strings in the programs? List the available string…
A: According to the company guidelines, we can answer only the first question. Please repost the other…
Q: You are required to make changes in the below programs and introduce the use of compaction where…
A: C programming is a general-purpose, procedural, imperative computer programming language developed…
Q: Write c++ program and test the following functions : void multiply (float a[ ], int n, float b [ ]…
A: #include<iostream.h>#include<conio.h>void multiply(float a[],int n,float b[]);void…
Q: y = -x + 3 x + 4 – 1 <x<4 at Ax = 1 d. Write a function for the following equation using f(x) in…
A: According to bartleby rule i can only solve first three subpart but i solved till g for next part…
Q: Write a c++ program: NOTE: Pointers must be used to solve the following problem. Write a function…
A: Pointer: The pointer variable stores the address of a variable or points to the address of another…
Q: Question 2. Write a C++ program to perform following tasks: Declare a dynamic array of size 's’.…
A: #include<iostream>using namespace std;int main() { int s,i,randomNumber; cout <<…
Q: Comment on the output of the following C code. #include struct temp { int a; int b; int c; };…
A: Here, I have to choose an option for the above question.
Q: consider the the following code: 1 sinclude ciostream 2 using namespace std; void add(int i, int j);…
A: 14.Result: 3 15 Result: 2.1 16 Result : 6 17. Result:24 The char m is K 18.The value of variables at…
Q: Consider the following code in C syntax, (use static scoping) #include #include int bar(int a, int…
A: Provided the solution for above given program and also shown the output of the given program as…
Q: 11. Given the following recursive definition f(1) = f(2) = 2 f(n) = 2∗f(n−1)+ f(n−2) write the C++…
A: code: #include<iostream> using namespace std; int c = 0; // function to calculate value of f()…
Q: C++ Programming You are given a list of M positive numbers, Ao, A1. ..., AM-1- You have to answer Q…
A: Required: We have to write a code in C++ where we are provided with a list of M positive numbers,…
Q: B) Write a C++ Program to declare two dimensional arrays using pointers to pointers to facilitate…
A: #include <iostream>using namespace std;int main(int argc, char const *argv[]){ int ** arr =…
Q: Question 1. Analysis.…
A: - We can answer the first three questions only as per our guidelines. - We need to analyse and code…
Q: Need help converting this C++ code to java. 1. Bubble Sort #include using namespace std; void…
A: Solution: 1. Bubble Sort Java code BubbleSort.java public class BubbleSort{ static void…
Q: ere function f returns the results through address passing. Assuming c is a global complex number…
A: Complex increase is a more troublesome activity to comprehend from either an arithmetical or a…
Q: Write A Program In C The Example : #include #include #define MONTHS_SIZE 12 #define DAYS_SIZE…
A: Program: #include<stdio.h> #include<ctype.h> #define MONTHS_SIZE 12 #define DAYS_SIZE 7…
Q: Problem Statement: Consider an input string TAM of letters ‘A’, ‘M’, and ‘T’. This string, which is…
A: 1. Algorithm: Sort_TAM (TAMUK[]) start = 0, mid = 0, end = length(TAMUK) - 1 while mid <= end if…
Q: 02: Detect the errors (at least 8) in the following C++ program: #include int i, j, array(5,5),…
A: Your answer is given below.
Q: a- Consider the following program written in C syntax: void swap(int a, int b) { int temp; temp = a;…
A: Actually, function is a set of statements.
Q: Find errors and suggest correction, if any, in the following C++ statements. long float x; char *cp…
A: No. Error Corrections i. Too many types float x; or double x; ii. type must be matched char *cp…
Q: code for this in C: Write a program that reads two matrices of integers. It then generates the sum…
A:
Q: Problem 8. What is the correct syntax of declaring array of pointers of integers of size 10 in C++?…
A: Given: Problem 8. What is the correct syntax of declaring array of pointers of integers of size 10…
Q: Problem 1 What is this? what does the following program do? "C language" #include #define…
A: Given Program: #include <stdio.h> #define SIZE 10 int whatIsThis(const int b[], size_t p);…
Q: Write a complete one C++ program that performs the following task: a. A user-defined function to…
A: Following is the code that finds the odd numbers in the range specified by the user. Step 2 has the…
Q: Below is C code that runs successfully but now i want to rewrite this C code and convert it to MIPS…
A: the answer is an given below :
Q: Using comments in c explaining how each code works line by line. The whole program is given below.…
A: Code is given below.
Q: Write C++ Program to determine the max numbers between 2 arrays. For example: 6. | 3 1 |8 34 7 2 0…
A: Note as per our guidelines we are supposed to answer?️ only one question. Kindly repost other…
Q: 5. Consider the following program written in C syntax: void swap (int a, int b) { int temp; temp =…
A: Here we have given the explanation of the given task. You can find the solution in step 2.
Q: Write a C++ function named BubbleSort that performs bubble sort to sort an array of integers. The…
A: SUmmary In this question, we have to write a function called bubble sort. By using that function we…
Q: Problem 1 : Write a menu driven program in C to implement following matrix functions 1.Addition…
A: Note: In the BNED Guidance, only the first question can be answered at a time. Resend the question…
Q: Write C++ Program to determine the max numbers between 2 arrays. For example: 6 3 |1|8 | 34 7 |2 |0…
A: Note: Answering the first question as per the guidelines. Input: Array a1 and a2 from the user.…
Q: Explain this c code in details. #include int main() { int max_weight_truck, n; scanf("%d",…
A: #include <stdio.h> int main() { int max_weight_truck, n; scanf("%d", &max_weight_truck);…
Q: Problem Statement: Consider an input string TAM of letters ‘A’, ‘M’, and ‘T’. This string, which is…
A: Solution - This program is not possible in "R" programming so i solved this in C++ Algorithm:…
Q: 10. What is the result of the following code in C++ ? (assume all #include and the unseen code is…
A: p points to array x then exchange values using pointer in the for loop to after exchanging value…
Q: Problem Statement: Consider an input string TAM of letters ‘A’, ‘M’, and ‘T’. This string, which is…
A: 1. Algorithm: Sort_TAM (TAMUK[]) start = 0, mid = 0, end = length(TAMUK) - 1 while mid <= end if…
Q: Write a C++ program that tests the function main and the functions discussed in parts 1 through 5.…
A: Pass the alpha array as constant pointer so that alpha doesn't gets updated and beta can be udpated
Q: In C programming. How do I find the max and min values of the corressponding columns.
A: The code is below to find max and min element:
Q: Solve the Problem in C++ (Sum elements column by columns) Write a function that returns the sum of…
A: Introduction: Here we are required to write a function that returns the sum of all the elements in a…
Q: Write a C program that contains int count_zero(int a[ ][6], int n) function that takes two…
A: Takes two dimensional array. Use two for loops to check whether the current element is 0 if the…
Q: Use the following C++ program code to answer questions 5-7 1 include ciostream 2 using nanespace…
A: To do: 6th question
Q: 3/ Write a C code that will read 10 numbers into an (max_min), Smallest elements. A sample run of…
A: Answer in step2
What is the ouput f the following code
#include <stdio.h>
void fun (int *ptr)
{
--pt;
}
int main()
{
int y [] = {1,2,3};
fun (&y[1]);
printf("%d",*(y+1));
return 0;
}
a. Undetermined value
b. 1
c. 2
d.3
Step by step
Solved in 3 steps with 1 images
- 9o. Write a recursive function printRev ( int a[ ], int s, int e) that receives an integer array a [ ], a start index s, and an end index e. The function should print the array elements in reverse order. void printRev ( int a[ ], int s, int e); Trace your function given the following array and function call. Draw your steps. int a[ ] = {4, 2, 3, 5};and printRev(a, 0, 3); language c++ .Implement in C Programming 6.10.2: Pass by pointer. Write a function call to ConvertMoney() to store the number of quarters, nickels, and pennies within the integer variables numQuarters, numNickels, and numPennies, respectively. Ex: If the input is 133, then the output is: Quarters: 5 Nickels: 1 Pennies: 3 #include <stdio.h> void ConvertMoney(int totalPennies, int* numQuarters, int* numNickels, int* numPennies) { *numQuarters = totalPennies / 25; totalPennies = totalPennies % 25; *numNickels = totalPennies / 5; totalPennies = totalPennies % 5; *numPennies = totalPennies;} int main(void) { int totalPennies; int numQuarters; int numNickels; int numPennies; scanf("%d", &totalPennies); /* Your code goes here */ printf("Quarters: %d\n", numQuarters); printf("Nickels: %d\n", numNickels); printf("Pennies: %d\n", numPennies); return 0;}In C++, Can you please look at the code below and revise/fix so it will work according to instructions and criteria. Instruction 1) Write a function that copies a 1D array to a 2D array. The function’s prototype is bool copy1DTo2D(int d1[], int size, int d2[][NCOLS], int nrows); where size > 0 NCOLS > 0 nrows > 0 NCOLS is a global constant size = NCOLS * nrows the function returns true if the parameters and constants satisfy these conditions and false otherwise. the relation between 1d array indices and 2d array indices is 2d row index = 1d array index / NCOLS 2d column index = 1d array index modulus operator NCOLS 2) Write a function that copies a 2D array to a 1D array. The function’s prototype is bool copy2DTo1D(int d2[][NCOLS, int nrows, int d1[], int size); where size > 0 NCOLS > 0 nrows > 0 NCOLS is a global constant the function return true if the parameters and constants satisfy these conditions and false otherwise. the relation between 1d array indices and…
- In C++ The function below, zeroesToFives takes an array of integers and changes any zeroes in the array to fives and returns the count of array elements that were updated. Write at least ten test cases using assertions for zeroesToFives. You should test at least three boundary/edge cases.(C language) Write a function intersect() that takes five arguments: an array of integers, number of elements in this array, a second array of integers, number of elements in the second array, a third array as parameters; finds the numbers in the first array that also exist in the second array and places these numbers into the third array; returns the number of matching values stored in array-3. Prototype: int intersect(int ar1[], int n1, int ar2[], int n2, int ar3[]) ps: please do not copy paste from chegg or anywhere else. write a unique code.Java, I am not displaying my results correct. It should add up the digits in the string. input string |result for the sumIt Recursion functions and a findMax function that finds the largest number in a string "1d2d3d" | 6 total "55" |10 total "xx" | 0 total "12x8" |12 Max number "012x88" |88 Max Number "012x88ttttt9xe33ppp100" |100 Max Number public class Finder { //Write two recursive functions, both of which will parse any length string that consists of digits and numbers. Both functions //should be…
- #include <stdio.h> #define SIZE 8 void print_array(int a[], int size) ; void bubble_sort(int list[] , int size); //function declaration int main(void) { int items[SIZE] = {40, 82 , 25 , 98 , 33 , 54 , 15 , 40}; printf("Before Sorting: "); print_array(items , SIZE); bubble_sort (items , SIZE ); //function call printf("After Sorting: "); print_array(items , SIZE); return 0; } void print_array(int a[], int size) { int i; for (i = 0; i < size; ++i) printf("%d ", a[i]); printf("\n"); } /* Bubble sort of a list array in ascending order (i.e., from the smallest to the largest) */ void bubble_sort(int list[] , int size) { int i , pass , temp; for (pass = 0 ; pass < (size - 1) ; pass++) { for ( i = 0 ; i < (size - 1) - pass ; i++) { if (list[i] > list[i+1]) { //swap list[i-1] and list[i] temp = list[i]; list[i] = list[i+1]; list[i+1] = temp; } //if } //inner for } //outer for } //function the question:Please Help In JAVA Here is the skeleton of a code for insertion sorting in an imperative language. You have to add right lines of codes for the language you choose (C, C++, C#, JAVA etc,). The following sample is for C++. #include <iostream>#include <array>#include <stdio.h>#include <stdlib.h>#include <ctime>using namespace std; void insertionSort(int A[], int n){for (int i = n-2; i >= 0; i--){ int j; int v = A[i]; for (j = i + 1; j <= n-1; j++) { if (A[j] > v) break; else A[j-1] = A[j]; } A[j-1] = v;}} int *randomArray(int n){srand((unsigned) time(0));int * A = new int [n];for (int i = 0; i < n; i++){ A[i] = rand();}return A;} Sample function calls (call these functions in main driver function):int n = 100000;int * A = randomArray(n);insertionSort(A, n);delete [] A; Note: delete memory of first array before sorting second array. After you modify the code: (1) Generate 100, 000 random numbers and sort them (2) Generate 300000…Debug C language int element(int arr[], int num) { in i, ele; ele = arr[0]; for (i = 1; i < num; i++) if (arr[i] > ele) ele = arr[i]; return ele; } main() { arr[] = {1, 24, 145, 20, 8, -101, 300}; int n = sizeof(arr)/sizeof(arr[0]); printf("element of array is %d", element(arr[], n)); }
- 1.The following is the C code that you need to implement for this lab: uint8_ t f(uint8_tn) return(n<2)?(n):(f(n-1)+f(n-2)); The main function can be assumed as follows: int main() uint8_ t x; x=f(???); return 0; Obviously, " ? ? ? " is representing a value used to test the algorithm! Is "f"recursive? a.No answer text provided. b.Yes c.no d.depends on whether it is in for main 2.First, make the code in the previous question an actual C program so that it can be compiled and it runs. Play with it so that you feel comfortable with the logic of the code. Then implement the code in TTPASM. Note that you need to preserve the actual C code structure, this means you cannot it into a non-recursive subroutine. Furthermoreall conventions discussed in class regarding subroutines must be followed. The idea is that I should be able to substitute f with my own code, and main should work. Or, I can substitute main with my own, and f should work. Attach the source code of your assembly…in C programing Write a recursive function that returns 1 if an array of size n is in sorted order and 0 otherwise. Note: If array a stores 3, 6, 7, 7, 12, then isSorted(a, 5) should return 1 . If array b stores 3, 4, 9, 8, then isSorted(b,4) should return 0.int isSorted(int *array, int n){Program in C language (Please solve part 2) Part one : Write a program that does the following: Creates int array array_1 of length 10. Creates int array array_2 of length 10. Takes int values from the user of for 10 values for array_1 and array_2, each. Creates a new int array array_3 which copies the values of array_1 and array_2, in interleaved order, into it. Prints out the contents of Prints out the contents of array_1, array_2 and array_3. Part two : Repeat Part one, but this time use arrays of char (instead of int), and stop receiving input into array_1 and array_2 when the user hits Enter / newline and insert a Null character into the array