Question

In: Computer Science

Write code that would allocate the space for an array of 20 integers. It will be...

Write code that would allocate the space for an array of 20 integers. It will be pointed to by a variable named "junk"

Write code that puts “file did not open” into an error stream.

Solutions

Expert Solution

Q1.

#include<stdio.h>

#include<conio.h>

int main()

{

int a[20], i;

int *junk;

printf("\n Enter the elements:");

for(i=0;i<20;i++)

{

scanf("%d", &a[i]);

}

junk=&a[0];

printf("\n Elements are:");

for(i=0;i<20;i++)

{

printf("%d",a[i]);

printf("\n");

}

getch();

return 0;

}

Please upvote ??.


Related Solutions

write code to count the number of odd integers in an array of 100 random integers...
write code to count the number of odd integers in an array of 100 random integers in the range [0,99].
C++ Program: Write another program (in C++) that will allocate a local static array of integers...
C++ Program: Write another program (in C++) that will allocate a local static array of integers and then a dynamic array of integers. Are they stored next to each other? You can examine this by examining the memory addresses where they are located. As described in class, on some systems the size of a dynamic array is actually stored in the bytes previous to a dynamically allocated array. Through some experiments on your own, try to see if this is...
*****IN JAVA***** Write a code snippet that initializes an array with ten random integers and then...
*****IN JAVA***** Write a code snippet that initializes an array with ten random integers and then prints the following output: a. every element (on a single line) b. every element at an even index (on a single line) c. every even element (on a single line) d. all elements in reverse order (on a single line) e. only the first and last elements (on a single line)
Write a code to initialize a 2D array with random integers (not has to be different)....
Write a code to initialize a 2D array with random integers (not has to be different). Write a function to count the number of cells that contain an even number within the 2D array. C++
1. a. In C++, Write a program that creates an array of 20 integers and initializes...
1. a. In C++, Write a program that creates an array of 20 integers and initializes it with the even values starting from 200. i.e. 200, 202, 204…. b. Write the elements of the array to the file even.txt, each element on a separate line. Try to use a single for loop for initializing the array and writing to file. You will need a separate counter for initializing the array. 2. a. Write another program that opens the file even.txt...
write a code for given an array of integers where wachelement represents the maximum number...
write a code for given an array of integers where wach element represents the maximum number of jumps to reach the end of the array(starting from the first element) if an element O,then no jump can be made from that element if it is not possible to reach the end then output in c
Write a Java program to initialize an array with the even integers from 2 to 20...
Write a Java program to initialize an array with the even integers from 2 to 20 and print the result then pass this array to a method in order to create a new array which is the inverse of the array you passed (print the result). You cannot use a third array. Insert comments and version control in the program to document the program.
Declare an integer array of size 20 and assign the array with 20 randomly generated integers...
Declare an integer array of size 20 and assign the array with 20 randomly generated integers in the range [1, 100]. Shuffle the data in the array so that all numbers smaller than 50 are put before the numbers greater or equal to 50. Note you are not allowed to create any other arrays in the program. Finally, print out the shuffled array. (25 points) #include<iostream> using namespace std; const int NUM = 20; int main() {             //...
Write a program that does the following: Generate an array of 20 random integers between -100...
Write a program that does the following: Generate an array of 20 random integers between -100 and 100. Compute the average of the elements of the array and find the number of elements which are above the average. For example, if the elements of the array were 5 2 4 1 3 then your program should output The average is 3.0 There are two elements above the average Find the smallest element of the array as well as its index...
Write a Pseudo Code to send an Array of 20 elements from 8051 to the computer...
Write a Pseudo Code to send an Array of 20 elements from 8051 to the computer via serial port at maximum baud rate possible with XTAL=11.0592MHz.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT