News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Vista problem with float

Started by Malcolmj., February 10, 2011, 01:32:18 PM

Previous topic - Next topic

Malcolmj.

I am learning C.
I have been using a notepad running Vista, and have run into a problem sending a float value to a function with returning the correct value. If I use integers it works.
The program works ok on XP and Ubuntu.
Any one knows of issues with Vista and code::blocks compiling 'float'?
Any help will be most appreciated.

/*10 feb 2011 funnctions float*/
#include <stdio.h>
float x = 3.5, y = 65.11, z;

float half_of(float k);

main()
{
    z = half_of(x);
    printf("The value of z = %f\n", z);
    z = half_of(y);
    printf("The value of z = %f\n", z);
}
float half_of(float k)   /* values for x and y are arriving here ok.*/
{
    return(k/2);
}



Jenna

Code::Blocks is an IDE not a compiler !
Your question is compiler specific and therefore violating our forum rules.
This forum/website is dedicated to C::B related questions only.

Please ask it in an appropriate C/C++ - forum.

Topic locked !