I have changed the RTT calculation in tcp.cc file in ns2-allinone > ns2.35 > tcp folder. Then I have run the command 'make clean' and then ran 'make' at this time while running the simulator, it will work with the updated it doesn't show any change. I've again tried debugging with adding a printf() statement. But after doing make clean and then make the modification doesn't work when I run ns.
I found the solution.
I wrote in linux terminal, "whereis ns"
then it printed out some directory names.
I modified some files into ns2-allinone folder. But the ns2 that was running was in 'usr/bin' folder. The ns2 that was being executed was from 'usr/bin' folder.
So, I entered to that folder and opened the terminal. Then wrote'sudo rm ns2' and pressed enter.
Then I wrote ns in terminal. it showed error.
So, I went back to ns2-allinone> ns2.35 and then opened the terminal and wrote "make ns". After that my problems got solved.