#include <stdio.h> int return_false(); int main() { int array[10]; int idx = 0; if(return_false()) { array[idx++] = 1; } for(int i = 0; i < idx; i++) { printf("%i\n", array[i]); } return 0; }
Cppcheck outputs:
Checking test.c ... test.c:15:24: error: Uninitialized variable: array [uninitvar] printf("%i\n", array[i]); ^ test.c:9:20: note: Assuming condition is false if(return_false()) ^ test.c:15:24: note: Uninitialized variable: array printf("%i\n", array[i]); ^
Probably related to https://trac.cppcheck.net/ticket/11075
Log in to post a comment.
Cppcheck outputs:
Probably related to https://trac.cppcheck.net/ticket/11075