You are not logged in.

#1 2015-07-15 15:29:48

InsidiousMind
Member
Registered: 2014-02-18
Posts: 13

Valgrind not spitting out any errors

Hey,
I'm just getting into learning C and have installed valgrind in order to test my programs.

I created a small C program with errors to see if it would catch them, it didn't.

 #include <stdio.h>
 
 /*WARNING: This program is wrong on purpose. */
 
 int main(){
          int age = 10;
          int height;
   
          printf("I am %d years old.\n");
          printf("I am %D inches tall.\n", height);
 
          return 0;
 }
~                                                                    
~                                                                    
~                        

this is the error valgrind gives:

==19195== Memcheck, a memory error detector
==19195== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==19195== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==19195== Command: ./ex4
==19195== 
I am -16774840 years old.
I am %D inches tall.
==19195== 
==19195== HEAP SUMMARY:
==19195==     in use at exit: 0 bytes in 0 blocks
==19195==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==19195== 
==19195== All heap blocks were freed -- no leaks are possible
==19195== 
==19195== For counts of detected and suppressed errors, rerun with: -v
==19195== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

What's wrong with valgrind?

Offline

Board footer

Powered by FluxBB