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
Ymorist [56]
1 year ago
13

write a function print array to print an array on one line as: 9 8 7 6 5 4 3 2 1 0 write and test a function called bubble sort

that implements this sorting method and call it from your main function. you will need to swap elements to sort the array.
Computers and Technology
1 answer:
Lisa [10]1 year ago
4 0

Function print array to print an array on one line as:

void printArray(int arr[], int n)
{
   int i;
   for (i = 0; i < n; i++)
       printf("%d ", arr[i]);
   printf("\n");
}
void bubbleSort(int arr[], int n)
{
  int i, j;
  for (i = 0; i < n-1; i++)      
      for (j = 0; j < n-i-1; j++)  
          if (arr[j] > arr[j+1])
             swap(&arr[j], &arr[j+1]);
}
void main()
{
   int arr[] = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
   int n = sizeof(arr)/sizeof(arr[0]);
   printf("Given array is \n");
   printArray(arr, n);
   bubbleSort(arr, n);
   printf("\nSorted array is \n");

What is array?
An array is a type of data structure used in computer science that contains a set of elements (values and variables), each of which is designated by an array index or key. The simplest type of data structure is indeed a linear array, also known as a one-dimensional array. For instance, an array of ten 32-bit (4-byte) arithmetic operations, to indices 0 through 9, may be stashed as ten words at memory addresses 2000,2004,2008,..., 2036 (in hexadecimal: 0x7D0, 0x7D4, 0x7D8,..., 0x7F4) so that the element with index

To learn more about array
brainly.com/question/24275089
#SPJ4

You might be interested in
From the time users first visit a new website, or view a new media piece, how much time will they spend on the site before they
vesna_86 [32]

Answer:

D

Explanation:

They will stay as long because they want to explore and find out new things on that site and if possible compare with the other sites they have seen

7 0
2 years ago
Olivia needs to get permission to use a graph of data gathered by a trade association she plans to include the graph in a report
balandron [24]

Answer: by reading the copyright notice on the website where she found the graph.

Explanation: ~Apex~

3 0
3 years ago
Read 2 more answers
7.2.7: Part 1, Replace a Letter
Elza [17]

def replace_at_index(txt, ind):

   new_txt = ""

   for x in range(len(txt)):

       if x == ind:

           new_txt += "-"

       else:

           new_txt += txt[x]

   return new_txt

print(replace_at_index("eggplant", 3))

I wrote my code in python 3.8. I hope this helps.

4 0
3 years ago
Read 2 more answers
In which of the following movies, multimedia's special effect is used ? *
Mila [183]

\qquad \qquad\huge \underline{\boxed{\sf Answer}}

The Correct choice is ~ D

In all these movies, multimedia's special effects are used

5 0
2 years ago
Read 2 more answers
How to build blue glasses or the glasses that prevent UV light
Natalija [7]
I think you should go to the optical doctor
8 0
4 years ago
Read 2 more answers
Other questions:
  • Patient letters created from __________ use structured data and do not require a large amount of typing from the medical assista
    8·1 answer
  • Write three tasks students can preform in a digital classroom?
    9·2 answers
  • _________ involves connecting geographically remote computers into a single network and combining the computational power of all
    6·2 answers
  • The _____ lets you see what styles have been applied to specific parts of a document, such as headings.
    9·1 answer
  • WILL THUMBS UP!!!!!ALL COMMENTS!!!!!!
    11·1 answer
  • Please answer these questions! Will mark Brainliest!!
    7·1 answer
  • A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number of steps, and whose output i
    15·2 answers
  • What is the name of the device that senses the current flowing, tripping the circuit, and cutting off the electricity?
    13·1 answer
  • Uh i g08ujunuyv kjmn
    11·2 answers
  • Which of the following commands can be used to display socket information out to the terminal screen
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!