Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Im having problems with segmentation faults and I also need help with case 3 del

ID: 3659919 • Letter: I

Question

Im having problems with segmentation faults and I also need help with case 3 deleting a ship from the arrat thx for the help. #include<string.h>
#include<stdio.h>
#include<stdlib.h>

typedef struct
{
char name[25];
char ship_type; // Im having problems with segmentation faults and I also need help with case 3 deleting a ship from the arrat thx for the help. #include<string.h>
#include<stdio.h>
#include<stdlib.h>

typedef struct
{
char name[25];
char ship_type; // Im having problems with segmentation faults and I also need help with case 3 deleting a ship from the arrat thx for the help. #include<string.h>
#include<stdio.h>
#include<stdlib.h>

typedef struct
{
char name[25];
char ship_type; //

Explanation / Answer

All of ur scanf's are correct, so specify the line where u are encountering segmentation fault , by the way segmentation fault occurs due to incorrect allocation of memory to variables,like calling an 6th element of a 5 member-ed array. The case 3 has been modified case 3: printf("Please enter ship name you wish to delete: "); scanf("%s",&searchName); int flag; // this will store trhe lcoation of the position Of the ship for(j=0;j