It is not worth going to Salamanca on a day trip unless you are ready to take an early train or bus from Madrid, and then a late return from Salamanca.
Old City of Salamanca is a UNESCO heritage city, known for its remarkable group of buildings in Gothic, Renaissance, and Baroque styles. Madrid to Salamanca is a 2 to 3 hour journey each way and apart from the old university and tapas in Salamanca (which is great) there is nothing of so much significance to make a day trip (though it has UNESCO tag).
Salamanca university was founded in pre-Roman times. It is the third oldest in the world.
If you have 2 days them you can make a comfortable trip of Avila and Salamanca, staying a night in Salamanca and stopping by in Avila on your way back to Madrid. You can also experience the Castillian countryside and the famous food of the region.
Salamanca in itself is a foodie's paradise. If you planning a trip to Salamanca, do read this blog for knowing the best restaurants for cheap tapas and drinks.