can i make a p-trap from a 45 degree
No. That will likely not pass inspection.  Most codes require a trap seal of 2-4", which you will not get with a 45.

Trap seal is measured from the top of the trap bend, to the trap weir.