c++ - Why does my function print '0'? -


here code, don't know why happen:

#include <stdio.h>  void foo(float *);  int main() {     int = 10, *p = &i;     foo(&i); }  void foo(float *p) {     printf("%f\n", *p); } 

output :

0 

you calling function expecting float* pointer int. in c++ error , code not compile. in c warning , undefined behaviour anyway.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -