Access Violation
Chris Miller
chris at dprogramming.com
Thu May 11 10:42:59 PDT 2006
On Thu, 11 May 2006 13:35:05 -0400, Robert Jones
<robertjones21 at HotPOP.com> wrote:
> Why am i getting an access violation:
>
> C:\Documents and Settings\jareth\Desktop>dmd -v -w ly2au.d
> parse ly2au
> semantic ly2au
> semantic2 ly2au
> semantic3 ly2au
> code ly2au
> generating code for function 'main'
> c:\dmd\bin\..\..\dm\bin\link.exe ly2au,,,user32+kernel32/noi;
>
> C:\Documents and Settings\jareth\Desktop>ly2au
> Enter number of light years: 5
> Error: Access Violation
>
> Attached is the source code.
Your scanf is wrong; it takes a pointer to a float, not a real; or you can
use %lf for double*.
double tempx;
scanf("%lf", &tempx);
x = tempx;
More information about the Digitalmars-d-learn
mailing list