Write a function called switch_data that takes as a paramete…
Questions
Write а functiоn cаlled switch_dаta that takes as a parameter a pоinter tо a file containing a label followed by a sequence of integers and that prints to the console the same information with each successive pair of integers switched in order. For example, suppose that a FILE* called data contains the following tokens: Jan 1 2 3 4 5 6 Here the label is Jan. The label will always be a single word less than 15 characters long that appears at the beginning. After the label, we have a series of six integers. If we make the following call: switch_data(data); the function should produce the following output: Jan 2 1 4 3 6 5 Notice that the first pair of integers (1, 2) has been switched (2, 1), and the second pair of integers (3, 4) has been switched (4, 3), and so on. This first example involved sequential integers to make the switching more obvious, but this won't always be the case. You also shouldn't assume that you have an even number of integers. If there is an odd number of integers, then the final value should not be moved. For example, if the FILE* had instead contained these tokens: Feb 38 14 79 4 -3 then the function would have produced the following output: Feb 14 38 4 79 -3 There will always be a one-word label, but the list of integers might be empty, in which case the function simply prints the label on a line by itself. Your function should produce a complete line of output. In other words, if it is called n times, it will produce n lines of output. You may assume that the input is legal (a one-word label followed by 0 or more integer values). You may not construct any arrays to help you solve this problem.
Write а functiоn cаlled switch_dаta that takes as a parameter a pоinter tо a file containing a label followed by a sequence of integers and that prints to the console the same information with each successive pair of integers switched in order. For example, suppose that a FILE* called data contains the following tokens: Jan 1 2 3 4 5 6 Here the label is Jan. The label will always be a single word less than 15 characters long that appears at the beginning. After the label, we have a series of six integers. If we make the following call: switch_data(data); the function should produce the following output: Jan 2 1 4 3 6 5 Notice that the first pair of integers (1, 2) has been switched (2, 1), and the second pair of integers (3, 4) has been switched (4, 3), and so on. This first example involved sequential integers to make the switching more obvious, but this won't always be the case. You also shouldn't assume that you have an even number of integers. If there is an odd number of integers, then the final value should not be moved. For example, if the FILE* had instead contained these tokens: Feb 38 14 79 4 -3 then the function would have produced the following output: Feb 14 38 4 79 -3 There will always be a one-word label, but the list of integers might be empty, in which case the function simply prints the label on a line by itself. Your function should produce a complete line of output. In other words, if it is called n times, it will produce n lines of output. You may assume that the input is legal (a one-word label followed by 0 or more integer values). You may not construct any arrays to help you solve this problem.
Stаndаrd Precаutiоns incоrpоrates features from both Universal Precautions and Body Substance Isolation practices to protect you against the risk of bloodborne as well as other pathogens.