1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Allisa [31]
2 years ago
8

Write a program which populates an array with integer values read from a file. We do not know how many integers are in the file,

so you must loop until the end of the file is reached. For this problem, you may NOT use the function feof(). Instead, use the result returned from fscanf() to determine the end-of-file. Recall, we can set the result of fscanf() to an integer variable, and check to see if the integer variable is equal to the EOF marker. The program must take the items in the array and reverse them. You may use one array only to solve this problem.
Computers and Technology
1 answer:
max2010maxim [7]2 years ago
5 0

Answer:

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

int main()

{

int arr[100];

int i = 0;

int j = 0;

char c[10];

char temp;

int sum = 0;

FILE* fp;

if ((fp = fopen("test.txt", "r")) == NULL) {

printf("cannot open the file");

return;

}

else {

do {

temp = fgetc(fp);

if (temp == ' ' || temp == '\n') {

c[j] = '\0';

arr[i++] = atoi(c);

j = 0;

continue;

}

c[j++] = temp;

} while (temp != EOF);

for (j = i - 1; j >= 0; j--) {

printf("%d\n", arr[j]);

}

}

getchar();

}

Explanation:

You might be interested in
What kind of output device would not be used to output images
saveliy_v [14]

Answer:

Speakers.

Explanation: Cause they only output sound, and are devices, further more they are not used to output images, like how could speakers output images using sound? They can't.

3 0
3 years ago
So I try to login into my origin account and this popped up.(photo). But everytime I try to type in something I’m unable to clic
Oduvanchick [21]
You have to restart your computer or maybe use another internet browser to access the website your trying to reach
7 0
3 years ago
The opposite of merging cells is splitting a merged cell
vodomira [7]
True , hope this helps!!
4 0
3 years ago
What is a Layer 2 device that receives an electrical signal in one port, interprets the bits, and makes a filtering or forwardin
iren2701 [21]

Answer:

Router

Explanation:

Router -

It is a networking device which helps to forward the data packets between the networks of the computer .

It acts as a traffic director in the internet .

The data which is sent via internet is made into data packets . And then the packet is forwarded from one router to another , until the packed reaches its destination .

The function given in the question is about router .

5 0
3 years ago
What is the serializable interface and what makes an object serializable?
Varvara68 [4.7K]

Answer: Serializable interface is the interface that acts as the maker persisting without any specific method and members in Java. The maker has the objective of identification of class for serialization method. This helps in the conversion of the object value in the byte form.

Object is serialized by converting the state into byte version and thus can be returned to object copy . The java.io.Serializable interface is the requirement for the conversion of any object of particular class or superclass. This technique is followed for making the data flow on the network efficient and easy.

5 0
3 years ago
Other questions:
  • John is analyzing strange behavior on computers in his network. He believes there is malware on the machines. The symptoms inclu
    5·1 answer
  • How do you increase the amount of data in a sampled Google Analytics report?
    8·1 answer
  • Carlos owns a hardware store. He currently is not using any software to track what he has in the store. In 1–2 sentences, descri
    9·2 answers
  • Good ways to increase sales on phone accesories?
    10·2 answers
  • Circular errors are caused by adding the cell name of a/an _______ cell to a formula.
    6·2 answers
  • Fill in the blanks in the SQL statement below that will list the invoice number, invoice total and credit which is the total sum
    14·1 answer
  • Examples of system software include operating systems like macos, Linux, Android and
    10·2 answers
  • Can somebody do an Algorithm 2 for more?<br> (Python)
    15·1 answer
  • How many different textile items would you find at a festival? (please list 5 items)
    7·1 answer
  • a printer's accessory list includes a maintenance kit with a variety of replaceable parts you should install after 100,000 pages
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!