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: int fun(int k){ return ( ); void main(){ int n; cin >> n; n = n * fun(n); <-- 1 Fill in the…
A: Your answer is given below as you required with an output.
Q: using namespace std; int maxResult() int maxVal for (int i 0; i <= n; i += a) for (int j { float z =…
A: Task : Given the code in C++. The task is to debug the code and find the correct output.
Q: #include using namespace std; int main() (char names[12][10]={"ahmed", "alaa", "hussain", "mahmod",…
A: Given C++ program contains a two dimensional array which contains six strings. Then it contains a…
Q: #include void main() { int i; int number[11]={12,15,17,3,2,7,10,10,15,15,50}; for(i=0;i< 11; i++){…
A: Over here array is given which has 11 elements and we have to find a Maximum, Minimum, and average…
Q: the code editor, there's already an initial code that contains the function declaration of the…
A: Please find the answer below :
Q: Code: #include using namespace std; void BUBBLE(int A[],int N){ for(int k=0;kA[ptr+1]){…
A: Explanation: To remove the function from the program and writing everything into a main function is…
Q: Outputs of the following: void main () { int M[3]; int "ptr; ptr=M; *ptr=100; ptr++; "ptr=200;…
A: void main(){ int m[3]; //declaring an array int *ptr; //declaring a pointer ptr=m;…
Q: Function Call Diagram Write a function call diagram showing this program. #include…
A: Explanation: The given program contains three functions, “main()”, “average()”, “sum()” . Here,…
Q: What does the code below do? #include // Demonstrated in Chapt 4 lecture void main(void) {…
A: Algorithm:Initialize variables: intC, intCount myChar[] = "".Prompt the user to enter a string.Read…
Q: implement a Cfunction with the following header Int processPointers(int "p, int "q, int n) the…
A: C program to implement a function processPointers that take two arrays and their size as argument…
Q: Complete the function given below: bool compare_arr(int arr1[], int n, int arr2[], int m){ I/return…
A: Complete the given C++ function to compare the first and last elements of both the arrays and return…
Q: C++ PROGRAMMING PART C Please help me i am stressing so much on this. I would really appreciate…
A: We have given a size, N that will be the size of the parking array. parking array represents the…
Q: #include struct dna { int number; char text; char stringvalue[30]; }; int main() {…
A: NOTE: - As asked the comments are being added on each line of the program. Any modification other…
Q: Programming c
A: Array is arranging or collection of elements of same datatype or homogeneous datatype. Explanation…
Q: bool palindrome(const int a[], int start, int end); This function is to return true if elements from…
A: Answer: We have done some modification in your code and we have attached the code and output…
Q: In C Programming: Write a function inputAllCourses() which receives an array of course pointers and…
A: Algorithm : 1. Start 2. Declare an array of Course pointers. 3. Allocate memory for the number of…
Q: Explain this C code line per line please #include #include void printArray(int**,…
A: #include<studio.h>//defining header file # include <malloc. h>//header file for…
Q: #include using namespace std; void division(int num,int denom); int main() { division(5,-1); return…
A: Explanation:- When the denom variable is passed as less than or equal to 0 then in the division…
Q: c
A: Error: The variable i is not declared. Nature: The variable i is used in for loop but never been…
Q: static int sum_calc(int arr[], int len) { int sum = 0, index = 0; while (index <= len) { sum = sum +…
A:
Q: TotalResistance() { series_res=parallel_res=sp_res=0; } void seriesResistance(double…
A: The following are the name of the classes:- TotalResistance: This class is used to find out the…
Q: What is the ouput of the following C code segmer void * T( void* me) { int s=0; for (int k=1; k<=me;…
A: It is defined as a powerful general-purpose programming language. It can be used to develop software…
Q: Lab 6 Use the lab5.cpp as a started file. Modify the program is it generates 1000 points with a…
A: The Algorithm of the code is as follows:- 1. Set up an array of structs to hold 1000 points2. Set up…
Q: cmpl $4 , %edi movl %edi , %edi jmp .L4(,%rdi,8) .L3: movl $17, %eax ret .L5: movl $3, %eax int A (…
A: A = X B = W
Q: // index <- find the index of the RECORD with given restaurant_id in restaurant_array ????? (I…
A: The index of the RECORD has to be found with given restaurant_id in restaurant_array and if no id…
Q: #include using namespace std; class test{ public: test(){ cout<<"alpha\n"; } ~test(){…
A: Given: #include <iostream>using namespace std;class…
Q: #include using namespace std; class test{ public: test(){ cout<<"
A: Code: #include <iostream>using namespace std;class…
Q: Q1 #include int arrC[10] = {0}; int bSearch(int arr[], int l, int h, int key);…
A: The Flowchart for the algorithm: Handwritten on image.
Q: matrix = {{1,2},{4,5}} this in c++
A: Required:
Q: Complete the C function that prints all elements of an array using pointers. The elements of each…
A: Please find the answer below :
Q: #include using namespace std; // define a function // pass a 2d array as a parameter void…
A: To call a function, simply pass the required parameters along with the function name. Complete…
Q: In C programming: Write a main() function using the following requirements: • Define a SIZE…
A: Step 1: Declare a const SIZE that stores 5. Step 2: Declare a struct course that stores the name of…
Q: int* p; int a[3] = {1, 2, 3); p = a; What is the value of *(p+2)?
A: We are we are given an array a and a integer pointer variable p. we are asked the value of *(p+2).…
Q: #include using namespace std; int main() {char names [18][8]={"saif", "4", "8", "hussain", "5","2",…
A: In the given c++ program
Q: C++ language
A: As per the requirement program is executed. Algorithm: Step 1: Write the main() method Step 2:…
Q: Why does little-endian vs. big-endian matter here in this code
A: Answer: Little-endian: The little-endian show is a kind of addressing that alludes to the request…
Q: #include int arrC[10] = {0}; int bSearch(int arr[], int l, int h, int key); int…
A: Flowchart of above program:
Q: Example Input: 2 1 2 3 2 5 6. 1 2 2 1 1 2 Output: 2 2 1 3
A: Algorithm: Step1: Take the input length of the array Step2: Now we initialize the map…
Q: char *args[10]; int n; int *a; BOX; t main(){ вох а[100]; BOX *p; BOX x; BOX * b[10]; // ... A. char…
A: B b[2] F x.n G a[2].a D p.n A x.args[3] G &(p->n) E *(a[10].args[3]) D *((*p).a)
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
- Consider the producer-consumer problem where the producer produces items to be consumed by the consumer. A solution of the problem is to be implemented using threads. The main process will run producer and consumer as two different threads. The producer will put the items it generates into a buffer of length 15. The consumer reads the elements of the buffer to get the items. A solution is given below. Each item produced and consumed are also printed to the screen. Run the program several times and find a sample run when the items produced are not correctly consumed. Explain why the program does not always work correctly.in c, how to pass the values of d array to the void DisplayImage function and print the elements of that array one by one using pointers defined in the functionIn c++, write a function void zero(int a[], int size, int target) that sets all elements of a larger than target to zero. Include a sensible main function which calls the function and prints out the results.
- #include <iostream> using namespace std; // define a function // pass a 2d array as a parameter void display(float numbers[][2]) { cout << "Displaying Values: " << endl; for (int i = 0; i < 3; ++i) { for (int j = 0; j < 2; ++j) { cout << "num[" << i << "][" << j << "]: " << numbers[i][j] << endl; } } } int main() { // initializing the 2 dimensional array. int actions[3][2] = { {30, 704}, {70.9, 51.7}, {35.7, 11.92} }; return 0; } Display and explain your answer.using namespace std; int main() int i, m=0,n=4; float arr[100] (55,66,88,1); for(i=0; iQUESTION 22 Multiple Choice: Which java statement correctly processes an array variable ? O while (x < arr.length){ int value = arr[x]; x++; } %3D for(int x = 0; x < arr.length; x++){ int value = arr[x]; } %3D process(arr); do { int value = arr[x]; x++; } %3D while (x < arr.length); QUESTION 23 True or False: An array is a basic data type. O True FalseA function in C++ that takes input from the user and stores it in an array #include<iostream> using namespace std; int main(int argc, char const *argv[]){int size = 5;int arr[size]; return 0; }5- int arr[4]= {2, 4, 5, 3); for (int i= 0; i<4; i++) cout<explain the use of each lineGiven the following declaration : char msg[100] = "Department of Computer Science"; What is printed by: strcpy_s(msg, "University"); int len = strlen(msg); for (int i = len-3; i >0; i--) { msg[i] = 'x'; } cout << msg;#include <stdio.h>#include <string.h>#define SIZE 6struct Cake {char name[50];float price;};int searchChoice(char *choice, struct Cake data[]);void displayChoice(int index, struct Cake data[]);int main() {char choice[50];int index;//Answer for Part (i) – Declare and initialise array stockprintf("What is your choice of cake? ");gets(choice);index = searchChoice(choice, stock);displayChoice(index, stock);return 0;}//Answer for Part (ii) – Function definition for searchChoice//Answer for Part (iii) – Function definition for displayChoiceİN C LANGUAGE Typedef struct Complex { Double a; Double b; } COMP_t, *COMP; write a function which finds and returns the position of the complex number whose absolute value is maximum in a two dimensional array of complex numbers.Absolute value of z=a+bi is |z|=(a^2+b^2)^1/2SEE MORE QUESTIONSRecommended textbooks for youDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSONC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag…Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill EducationDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSONC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag…Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education