freeCodeCamp / devdocs

API Documentation Browser
https://devdocs.io
Mozilla Public License 2.0
35.37k stars 2.37k forks source link

What is expected according to logic is not in the output #2353

Open Shiv15072001 opened 3 weeks ago

Shiv15072001 commented 3 weeks ago

Bug report

OS information

windows 10

VS CODE with c extension gcc version 6.3.0 and online c compiler.

Steps to reproduce

include

int main(){

float a[5] = {10.4,44.4,556.55,33.43,55.33};
float *ptr1 = &a[0];
float *ptr2 = ptr1 + 3;

printf("%f\n", *ptr2);
printf("%f", (int)(ptr2 - ptr1));
return 0;

}

More resources

Expected ouput is:- 33.430000 3.0000000

Actual output is:- 33.430000 33.429993

Possible fix

i can't find possible fix