In this paper, the generalized Dedekind sums and Hardy sums are defined. The arithmetic properties of the generalized Dedekind sums are studied, and the generalized Hardy sums are expressed in terms of the generalized Dedekind sums. Finally, the generalized Subrahmanyam's identities and Knopp's theorems are given and proved.