We compute charm and bottom quark masses in the quenched approximation and in the continuum limit of lattice QCD. We make use of a step scaling method, previously introduced to deal with two scale problems, that allows to take the continuum limit of the lattice data. We determine the RGI quark masses and make the connection to the MSbar scheme. The continuum extrapolation gives us a value m_b^{RGI} = 6.73(16) GeV for the b-quark and m_c^{RGI} = 1.681(36) GeV for the c-quark, corresponding respectively to m_b^{MSbar}(m_b^{MSbar}) = 4.33(10) GeV and m_c^{MSbar}(m_c^{MSbar}) = 1.319(28) GeV. The latter result, in agreement with current estimates, is for us a check of the method. Using our results on the heavy quark masses we compute the mass of the Bc meson, M_{Bc} = 6.46(15) GeV.