int a=3, b =4, c[10];
int *p;
c[10] is initialized as all elements having a value of 2.
Write C statements for the following:
Make p point to the location of a.
Assign b to have its current value plus the value pointed to by p.
Assign the value of what p is pointing to equal to 0.
Make p point to the third element of c array i.e., first element is c[0]
Now assign to b the contents of the third element of c array using p.
Add 5 to the contents for pointed to by p.
Answer the following after having gone through the above sequence.
What’s the value of *p?
What’s the value to *(p + 3)?
What’s the value of *p++?
Now what’s the value of *p?
int a=3, b =4, c[10]; int *p; c[10] is initialized as all elements having a value of 2. Write C statements for the following: Make p point to the location of a. p = &a; Assign b to have its current value plus the value pointed to by p. b += *p; Assign the value of what p is pointing to equal to 0. *p = 0; Make p point to the third element of c array i.e., first element is c[0] p = &c[3]; Now assign to b the contents of the third element of c array using p. b = *p; Add 5 to the contents for pointed to by p. *p = *p + 5; Answer the following after having gone through the above sequence. What’s the value of *p? 2 + 5 = 7 What’s the value to *(p + 3)? 2 What’s the value of *p++? 2 Now what’s the value of *p? 2
int a=3, b =4, c[10]; int *p; c[10] is initialized as all elements having a value...
a) Declare and instantiate an array named scores of twenty-five elements of type int. (b)Write a statement that declares an array namedstreetAddress that contains exactly eighty elements of typechar. 2. In a single statement: declare, create and initialize an arraynamed a of ten elements of type int with the values of the elements (starting with the first) set to 10, 20,..., 100 respectively. 3. Declare an array reference variable, week, and initialize it to an array containing the strings "mon",...
(10 pts) Define a two-dimensional array named temp with three rows and four columns of type int such that the first row is initialized to 6, 8, 12, 9; the second row is initialized to 10, 13, 6, 16; and the third row is initialized to 27, 5, 10, 20. (10 pts) Consider the following declarations, and see p.566: enum brands = { GM, FORD, TOYOTA, BMW, KIA }; const int N_BRANDS = 5; const int COLOR_TYPES = 6; double...
Hi!, having trouble with this one, In this class we use visual studio, C++ language -------------------------------------------------------------- Exercise #10 Pointers - Complete the missing 5 portions of part1 (2 additions) and part2 (3 additions) Part 1 - Using Pointers int largeArray (const int [], int); int largePointer(const int * , int); void fillArray (int * , int howMany); void printArray (const char *,ostream &, const int *, int howMany); const int low = 50; const int high = 90; void main()...
c++. please show screenshots of output
This project will continue to familiarize the student with using arrays. Store all the function proto-types in project11_funch and store all the functions in project11_func.cpp. Make sure you have proper header comments in each.h,.cpp file. When you run your program, your sample output should show your name. Your report should include the following: 1) project11_func.h 2) project11_func.cpp 3) project11.cpp 4) sample output Write the following functions: a) void fill_array_with_random_nums(int array(), int N): Fill array...
int a = 5, b = 4, c = -10; if(!(a>b++)) System.out.println("Value of a is: " + a); System.out.println("We are inside the if-statement!"); System.out.println("Value of b is: " + b); }else if (c%2 != 0 & c < 0){ //logical error (curly brace), syntax error c = c / 0; System.out.println(“We are now in the else section and c is a negative odd number!” + c); } else System.out.println(“c is even?”);...
Write a C program to do the following...in this EXACT order: a. Declare an integer array named alpha of 50 elements. b. Use a for loopt to initialize each element of alpha to its index value (e.g. alpha[0] = 0, alpha[1]=1, etc.). c. Output the value of the first element of the array alpha. d. Output the value of the last element of alpha. e. Set the value of the 25th element of the array alpha to 62 and output...
c
program
void funcint x, int *y) { 1. Whof the Rings gical ASA All of the above 1.0.2.4) What will be the out of the de int, pat) A) 10 12 (1.03.2) What will be the output of the following int , printf(d, a,b); A) & B) 17 11.12 D) 17.25 13. (L032) An array is a group of memory locations related by the fact that they all have my name and pe A) different different B) same, different...
Write a generic function int find_lower_bound(T seq[], int n, const T& value). The function returns the index of the largest element in the given sequence that is less than the given value. If multiple elements satisfy, return the one with smallest index. Return -1 if no such element exists. //main.cpp #include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; #include "source.h" struct Point{ int x,y; bool operator<(const Point& p) { return (x<p.x || (x==p.x&&y<p.y)); } }; int...
using visual studio
2) For each of the following, write C++ statements that perform the specified task.. (Ref: classwork named pointer2) a) Declare a built-in array of type unsigned int called values with five elements, and initialize the elements to the even integers from 2 to 10. b) Declare a pointer vPtr that points to a variable of type unsigned int. c) Write two separate statements that assign the starting address of array values to pointer variable vPtr. d) Use...
a) (C language) Let’s consider an integer array of size 10. (10 marks, each part is 2 marks) int a[10]; I. How would you assign a pointer, called pA, to store the address of element 0 of this array? Write the C code for your answer. II. Using pA, how would you obtain the value of the next element (element 1) of the array? III. Explain in 2-3 sentences what the statement pA = a[1]; would do. IV. Is the...