Question: Please fix anything wrong in this code since when i execute the code I get the error saying segmentation fault As shown below. 1 2

 Please fix anything wrong in this code since when i executethe code I get the error saying segmentation fault As shown below.1 2 3 #include #include int Input Year(); int Occurence(); int dayofweek();int new_years(int); int dayspassed(int, int, int); void results(int, int , int*, int,

Please fix anything wrong in this code since when i execute the code I get the error saying segmentation fault As shown below.int); int date(int*); int Leap Year(int); int main() { int day_of_week =

1 2 3 #include #include int Input Year(); int Occurence(); int dayofweek(); int new_years(int); int dayspassed(int, int, int); void results(int, int , int*, int, int); int date(int*); int Leap Year(int); int main() { int day_of_week = dayofweek(); int year = Input Year(); int occurence = Occurence(); 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 int Jan1 = new_years(year); //day of new years int *days_passed; *days_passed= dayspassed (occurence, day_of_week, Jani); int month=date( days_passed); results(occurence, year, days_passed, month, day_of_week); return; } int dayofweek() { int day_of_week; printf("Enter day of week number -> "); scanf("%d", &day_of_week); return day_of_week; } int Occurence() { int occurence; printf("Enter occurence number -> "); scanf("%d", &occurence); return occurence; } int Input Year() { int Year; printf("Enter year number -> "); scanf("%d", &Year); return Year; 36 37 38 39 40 41 42 43 44 45 46 47 48 49 } int LeapYear(int year) { int c = year % 4; return c; } int dayspassed (int occurence, int day_of_week, int new_years) { int daysPassed; daysPassed = (7*occurence) - (6-abs (day_of_week-new_years)); return daysPassed; } int new_years(int year) { int weekday; weekday = (((year-1)*365+((year-1)/4)-((year-1)/100)-([(year-1)/400) ) ) $7)+1; return weekday; } int date(int *days_passed) { int month = 0; if (*days_passed>31) 7/January { month++; *days_passed-=31; } if (*days_passed>28) //Febuary { month++; *days_passed-=28; } if (*days_passed>31) //March { month++; *days_passed-=31; } if (*days_passed>30) // April { month++; *days_passed-=30; } if (*days_passed>31) // May { month++; *days_passed-=31; } if (*days_passed> 30) //june { month++; *days_passed-=30; } if (*days_passed > 31) //july { month++; *days_passed-=30; } if (*days_passed > 31) //August { month++; *days_passed-=31; 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 } if (*days_passed > 30) //September { { month++; *days_passed-=30; } if (*days_passed > 31) //October { month++; #days_passed-=31; } } if (*days_passed > 30) //November { month++; *days_passed-=30; } if (*days_passed > 31) //December { { month++; *days_passed-=31; } return month; } void results(int occurence, int year, int *days_passed, int month, int day_of_week) { if(month==1) { printf("Desired occured #d of *d in d: January "p", occurence, day_of_week, year, days_passed); } if(month==2) { printf("Desired occured #sd of %d in Ssd: Febuarary Sp", occurence, day_of_week, year, days_passed); } if(month==3) { printf("Desired occured #rd of %d in ed: March &p", occurence, day_of_week, year, days_passed); } if(month= 4) { printf("Desired occured #9d of %d in 9d: April %p", occurence, day_of_week, year, days_passed); LIIVIILIIP-T/ { 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 printf("Desired occured #%d of %d in %d: April %p", occurence, day_of_week, year, days_passed); } if (month==5) { printf("Desired occured #%d of %d in %d: May %p", occurence, day_of_week, year, days_passed); } if (month==6) { printf("Desired occured #%d of %d in %d: June %p", occurence, day_of_week, year, days_passed); } if (month==7) { printf("Desired occured #%d of %d in %d: July %p", occurence, day_of_week, year, days_passed); } if (month==8) { printf("Desired occured #%d of %d in %d: August %p", occurence, day_of_week, year, days_passed); } if (month==9) { printf("Desired occured #%d of %d in %d: September %p", occurence, day_of_week, year, days_passed); } if (month==10) { printf("Desired occured #%d of %d in %d: October %p", occurence, day_of_week, year, days_passed); } if (month=-11) { printf("Desired occured #%d of %d in %d: November %p", occurence, day_of_week, year, days_passed); } if (month==12) { printf("Desired occured #%d of %d in %d: December %p", occurence, day_of_week, year, days_passed); } 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 } Enter day of week number -> 3 Enter year number -> 2021 Enter occurence number -> 3 zsh: segmentation fault "/Users/wooyun/Desktop/"code 10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!