No, There is no such demerit in DDA algorithm, you should use the following code, It will definitely work.
It will be better if you use Bresenham's line Drawing Algorithm.
You are only using dx to calculate unit step for your algorithm, thus it draws lines with angle < 45o.
You are not using dy in your program code for slope > 45o that is why your lines becomes broken. Append this code, and your code will work fine.
if(abs(dx)>abs(dy))
step=abs(dx);
else
step=abs(dy);