Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Shiv15072001 opened this issue Nov 4, 2024 · 0 comments
Open

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

Shiv15072001 opened this issue Nov 4, 2024 · 0 comments
Labels

Comments

@Shiv15072001
Copy link

Bug report

OS information

windows 10

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

Steps to reproduce

#include<stdio.h>

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant