fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int arr[5] = {10,20,30,40,50};
  6. int pos;
  7. int i;
  8. printf("Enter the location where you wish to delete element\n");
  9. scanf("%d", &pos);
  10. if ( pos > 4 )
  11. {
  12. printf("Deletion not possible.\n");
  13. }
  14. else
  15. {
  16. for ( i = pos ; i < 4 ; i++ )
  17. {
  18. arr[i] = arr[i + 1];
  19. }
  20. printf("Resultant array is\n");
  21. for( i = 0 ; i < 4 ; i++ )
  22. {
  23. printf("%d\t", arr[i]);
  24. }
  25. }
  26.  
  27. return 0;
  28. }
Success #stdin #stdout 0s 2252KB
stdin
2
stdout
Enter the location where you wish to delete element
Resultant array is
10	20	40	50