Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C program Vraag 1 / Question 1 [25] Skryf 'n C-program om 'n element van 'n skikking Write a C program to delete an element

C program

image text in transcribed
Vraag 1 / Question 1 [25] Skryf 'n C-program om 'n element van 'n skikking Write a C program to delete an element from an te verwyder in 'n posisie wat deur die gebruiker array at a position that is nominated by the user genomineer word (sien figur hieronder). (see figure below). NB: Hierdie program moet wysers (pointers) NB: This program should use pointers for array gebruik vir skikkingmanipulasie. Die gebruik manipulation. Using the square bracket van die blokhakienotasie vir notation for array manipulation is not skikkingmanipulasie word nie toegelaat nie! allowed! (eg. arift) (bv. arr[ ]) The program should ask the user for the size of the Die program moet die gebruiker vra om die grootte array as well as the elements to be stored in the van die skikking, asook die elemente wat gestoor array. Then the position that is to be deleted from word in die skikking in te lees. Daamna moet die the array should be entered by the user. The posisie wat verwyder moet word uit die skikking program should print an error message if the delete ingelees word deur die gebruiker. Die program position is invalid and ask for a new position to moet 'n fout boodskap vertoon as die posisie delete until a valid choice is made. If a valid choice ongeldig is en vra vir 'n nuwe posisie om te is made the element at that position is to be deleted verwyder totdat 'n geldige keuse gemaak word. As from the array. In geldige keuse gemaak is, word die element by daardie posisie verwyder uit die skikking. Hint: Use pointers to shift the elements of the array that follow the delete position one index Wenk: Gebruik wysers (pointers) om die elemente towards 0 to overwrite each element with the one van die skikking wat volg op die posisie wat that follows. After the deletion there will be one verwyder moet word, een indeks na O te skuif deur element left at the end of the array that is no longer elke element te oorskryf met die een wat daarop taken into account. volg. Na die verwydering sal daar een element aan die einde van die skikking oorbly wat nie meer in Show the final array (after deletion) on the screen, ag geneem word nie. omitting the redundant element at the end of the array. Vertoon die finale skikking (nadat die posisie verwyder is) op die skerm, en laat die oortollige element aan die einde van die skikking uit. - X Question 1 Enter size of the array: 6 Enter elements in array element 1: 35 element 2:- element 3: 11 element 4: 24 element 5: -3 element 6: 55 Enter the element position to delete: 2 Elements of array after delete element 1: 35 element 2: element 3: 24 element 4: -3 element 5: 55

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions