Lỗi uninitialized local variable a used trong links list năm 2024
This local variable may be used before it is defined. If a variable is assigned to in a function and not explicitly declared RecommendationReview the code and consider the intended scope of the variable. Determine whether the variable should be global or local in scope. If a global variable is required then add a ExampleThe following code includes different functions that use variables. Em viết code bài tìm ngày kế tiếp tự dưng bị lỗi c4700:uninitialized local variable 'x' used tiền bối nào giải thích giúp với Code: include
include typedef struct { int ngay; int thang; }ngaythang; ngaythang nhap(char *m); void xuat(ngaythang n); ngaythang ngayketiep(ngaythang n); void main() { ngaythang n,ngaykt; n = nhap("moi nhap ngay thang"); ngaykt = ngayketiep(n); xuat(ngaykt); _getch(); } ngaythang nhap(char *m) { ngaythang n; printf(m); do { } while (n.ngay>31 || n.ngay < 1);
do
{ } while (n.thang>12 || n.thang < 1);
return n;
}
void xuat(ngaythang n)
{
printf("ngay %d, thang %d", n.ngay, n.thang);
}
ngaythang ngayketiep(ngaythang n)
{
ngaythang x;
//tim ngay ke tiep
if (n.ngay != 30 && n.ngay != 31) else
if (n.ngay == 30) else
{ }
//tim thang ke tiep
if (n.thang == 12) else return x;
}My issue is i am getting error C4700: uninitialized local variable 'response' used on line 26. I know it's probably something simple I'm completely missing please help. The local Driver's License Office has asked you to write a program which grades the written portion of the driver's license exam. The exam has 20 multiple choice questions. The correct answers are: 1. A 2. D 3. B 4. B 5. C 6. B 7. A 8. B 9. C 10. D 11. A 12. C 13. D 14. B 15. D 16. C 17. C 18. A 19. D 20. B In main, declare an array and initialize it with the above correct answers. Also declare a second array for an exam taker's answers, and get a text file name from the user.
Hint: open (and close) the file in the function.
@ngoisaochip wrote:
Posts: 4 Participants: 3 Read full topic |