burn bootloader to Arduino Mega 256

My Arduino does not upload the sketch and gives error. I want to burn bootloader to Arduino Mega 256 by another Arduino Mega 256. what should I do?

You should tell what error it give while you uploading code.

if you are uploading code with library function make ensure they define properly