In next program I intend it to be the D version of a C program, but I found some troubles with it, can we keep the C style of it as it is as we can and fix the must-be-fixed parts to make it works under D compiler?

// D programming language

import std.stdio;
import core.stdc.stdio;
import core.stdc.string;

int main()
{


char x[20];

fgets(&x[0],x.sizeof,null);

x[strcspn(&x[0],"\n")]=0;

writeln(x);

if(!strcmp(&x[0],"hello world!"))
{

writeln("yes");

}

return 0;
}

Reply via email to