Question

In: Computer Science

In C++ Create a dynamic array of 100 integer values named myNums. Use a pointer variable...

In C++

Create a dynamic array of 100 integer values named myNums. Use a pointer variable (like ptr) which points to this array. Use this pointer variable to initialize the myNums array from 2 to 200 and then display the array elements. Delete the dynamic array myNums at the end. You just need to write part of the program.

Solutions

Expert Solution

#include <stdio.h>

int main()
{
int myNums = (int*)malloc(100 * sizeof(int));
int *ptr=myNums;
ptr[0]=100;
for(int i=2;i<=200;i++)
ptr[i]=i;

for(int i=2;i<=200;i++)
printf("%d ",ptr[i]);
return 0;
}

DON'T FORGET TO HIT LIKE.

THANKS BY HEART.


Related Solutions

In C create an array of 4 integers. Assign a pointer to the array. Use the...
In C create an array of 4 integers. Assign a pointer to the array. Use the pointer to find the average value of the elements in the array and display the results on the screen.
C++ 3a)Assume you have an integer pointer variable named intpoint2. It contains the address 1e6f24. You...
C++ 3a)Assume you have an integer pointer variable named intpoint2. It contains the address 1e6f24. You execute intpoint2++. What does intpoint2 now contain? a)1e6f24 b)1e6f25 c)1e6f28 d)1e6f2c 3b)You have an array of integers: int myints[10]; and the address of the first integer is be4350. What is the address of myints[1]? myints[2]?You have an array of integers: int myints[10]; and the address of the first integer is be4350. What is the address of myints[1]? myints[2]? a)Both are b34350 b)be4350 and b34354...
In the following keypad notation Use a class and dynamic allocation of a pointer variable to...
In the following keypad notation Use a class and dynamic allocation of a pointer variable to enter the digit code of the following text input MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY SUNDAY Use an inherited class using pointer variable to output the phone number from the following text input 1-800-COMCAST 1-800-VERIZON 1-800-BANCORP 1-800-MYKOHLS 1-800-JCPENNY Write C++ code and pseudocode in a doc file A computer key board has defect (like speech defect in humans) in reading for ‘p’ /’P’ as...
In the following keypad notation Use a class and dynamic allocation of a pointer variable to...
In the following keypad notation Use a class and dynamic allocation of a pointer variable to enter the digit code of the following text input MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY SUNDAY Use an inherited class using pointer variable to output the phone number from the following text input 1-800-COMCAST 1-800-VERIZON 1-800-BANCORP 1-800-MYKOHLS 1-800-JCPENNY Write C++ code and pseudocode in a doc file A computer key board has defect (like speech defect in humans) in reading for ‘p’ /’P’ as...
Using C# Create a class named Inches To Feet. Its Main()method holds an integer variable named...
Using C# Create a class named Inches To Feet. Its Main()method holds an integer variable named inches to which you will assign a value. Create a method to which you pass inches. The method displays inches in feet and inches. For example, 67 inches is 5 feet 7 inches.
Create a class using C# named InchesToFeet. Its Main()method holds an integer variable named inches to...
Create a class using C# named InchesToFeet. Its Main()method holds an integer variable named inches to which you will assign a value. Create a method to which you pass inches. The method uses 2 ref parameters: feet, inches left of type int and a parameter that is not ref of type int to which you pass inchesinches. For example, 67 inches is 5 feet 7 inches.
Define an array named PeopleTypes that can store a maximum of 50 integer values that will be entered at the keyboard.
Define an array named PeopleTypes that can store a maximum of 50 integer values that will be entered at the keyboard. Enter a series of 1s, 2s,3s and 4s, into the array, where a represent an infant, a 2 represent a child, a 3 represents a teenager, and a 4 represents an adult who was present at a local school functionp.412 PE 4Write a C function that finds and displays the maximum value in a two dimensional array of integers....
Create a random number generator object named myRandom and an integer variable named intRoulette. Set intRoulette...
Create a random number generator object named myRandom and an integer variable named intRoulette. Set intRoulette to be a random number from 0 to 36 (including the numbers 0 and 36). (visual studios 2015) using tryparse
write a function named as cubeCalculator that takes an integer pointer as function and return its...
write a function named as cubeCalculator that takes an integer pointer as function and return its cube value , you are required to compute the cube of a number using pointer notation , return the result as an integer value , use c++
Write a C program to Declare an integer array of size 10 with values initialized as...
Write a C program to Declare an integer array of size 10 with values initialized as follows. int intArray[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; Compute each item of a new array of same size derived from the above array by: adding first item (intArray[0]) of the array with 3rd, 2nd with 4th, 3rd with 5th and so on. For the last-but-one item intArray[8], add it with first item and for the last item (intArray[9])...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT