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
Which type of RAM is used exclusively in laptops?<br> a) SODIMM<br> b) DDR3<br> c) DDR<br> d) DDR4
Black_prince [1.1K]

Answer:

DDR3

Explanation:

6 0
3 years ago
A system analyst generally needs to have a number of skills. For example, technical and analytical skills are required for this
polet [3.4K]

Answer: See explanation

Explanation:

Systems analysts are the people who analyse how a particular software, or IT system will be able to fit and meet the needs of their company or client. They are charged with the responsibility of writing requirements for new systems.

Some if the skills required for a system analyst include:

• Flexibility

• Strong analytical skills

• Adaptability

• Initiative

• Interpersonal skills.

• Attention to detail.

• Teamwork skills.

• Written and verbal communication skills.

8 0
3 years ago
Using the _______ list, you can select the number of photos that will appear on each slide.
Pavlova-9 [17]
I think the answer is c
5 0
4 years ago
What are preconceptions?
anastassius [24]
An idea or statement  that you had previously or earlier.

6 0
4 years ago
Read 2 more answers
What was Ada Lovelace's contribution to computer science?
Alika [10]

Answer:

She made the first computer.

Explanation:

Augusta Ada King, Countess of Lovelace (née Byron; 10 December 1815 – 27 November 1852) was an English mathematician and writer, chiefly known for her work on Charles Babbage 's proposed mechanical general-purpose computer, the Analytical Engine.

8 0
2 years ago
Read 2 more answers
Other questions:
  • What is the correct order of network types when categorized by their size or the physical area they cover, from largest to small
    5·1 answer
  • Nine and 2 hundred thirty-five thousandths has a decimal
    5·2 answers
  • \Read the sentence.
    12·1 answer
  • How do you get free Wifi on your phone without paying
    6·1 answer
  • In 1–2 sentences describe how you would insert a row in a spreadsheet.
    11·1 answer
  • BRAINLIEST !!A game design document is like a diary for game developers.
    11·1 answer
  • What would be the best thing you could do to prepare yourself to work for a company that has embraced globalization. A) learn ho
    12·2 answers
  • Redundancy can be implemented at a number of points throughout the security architecture, such as in ________. Group of answer c
    12·1 answer
  • Which statement is true about hacking?
    11·2 answers
  • URGENT!! thank you!!!!!
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!