Tan Haoqiang
Abstract
Tan Haoqiang (谭浩强, born 1934) spent his first quarter-century at Tsinghua University as a political cadre, not an engineer. In 1978, aged 44, he began teaching himself BASIC; by the early 1980s he was teaching it on national television, and he went on to write the textbooks from which several generations of Chinese students learned to program. His C程序设计 (C Programming), published by Tsinghua University Press since the start of the 1990s, is by his own count the most widely sold university computing textbook in the world: 17 million copies by 2025, out of 55 million for all his books. Those figures come from Tan and his publisher and have never been independently audited. Among Chinese programmers the same book is a running joke, criticized for teaching compiler-specific tricks and code whose behavior the C standard leaves undefined.
Student Cadre
Tan entered Tsinghua in 1953 to study industrial electrification in the Department of Electrical Engineering. From his first year he was what Tsinghua’s president Jiang Nanxiang called a shuangjiantiao (双肩挑, “carrying on both shoulders”): a student who studied and did political work at the same time. He was branch secretary of the Communist Youth League in year one, a political counsellor in year three, and eventually chairman of the student union and deputy secretary of the university’s Youth League committee. By his own estimate, half of every academic year went to political work. The counsellor job added half a year to his studies, so he actually finished in March 1959, although his degree is dated 1958.
In 1956 he was one of about ten students moved into a new automatic-control class, the nucleus of the Department of Automatic Control founded in 1958. The department had too few teachers, so the class went to Beihang once or twice a week to hear Soviet experts lecture. His classmate Zhang Bo, one of the class’s strongest students, was kept on as a teacher. Tan stayed on the Youth League staff. As a student delegate he stood in the back row of a photograph with Mao Zedong, Liu Shaoqi, Zhou Enlai, and Deng Xiaoping on 1 February 1957, and sat in the front row at the Third National Youth Congress on 13 April 1958. “I never thought of becoming a computer education expert,” he said in 2025. “Never even thought of it.”
BASIC on Television
The opening came with the reform era. When China’s television university (the Central Radio and TV University, which had no classrooms and broadcast its courses on CCTV) wanted a course on BASIC, it could not find anyone at Tsinghua who had studied the language. Tan had not studied it either. He agreed anyway and, as he put it, “learned it and sold it on the spot,” teaching himself from foreign textbooks from 1978 and then moving on to Fortran. He bought an assembled computer between 1978 and 1980 because he could not write about programs he could not run.
The course book, BASIC语言 (The BASIC Language), written with Tian Shuqing and Xie Xiying, appeared from the Science Popularization Press in Beijing in December 1980. Tan began lecturing around 1981. The programs were recorded at Tsinghua’s audiovisual center and broadcast in half-hour slots in the afternoon, first for the television university and later as regular CCTV programming; after three or four years of live teaching the recordings were rerun. Tan’s own account puts the audience at one million viewers and the book’s sales at over 12 million copies. Material collected by his 2025 interviewer credits him with televised courses in seven programming languages. The BASIC book was his entry into what the encyclopedia covers in BASIC: The Language That Democratized Programming: a language designed for beginners, carried here by a broadcaster to a country with very few computers.
In 1985 Beijing merged the branch campuses set up after 1978 into Beijing Union University. Tan, until then vice-president of Tsinghua’s First Branch School, gave up administration there and taught computing at the university’s automation college. In 1984 he was among the founders, with Xu Zhenyu, of the National Association of Fundamental Computer Education in Universities (全国高等院校计算机基础教育研究会), which he later chaired; he is now its honorary president. He also chaired the Ministry of Education’s committee for the NIT computer-application certificate and was vice-chair of the committee for the National Computer Rank Examination. He retired in 2006.
C Programming
Tan’s method was to write for people who knew nothing, at a time when, as he said, “the leaders didn’t know it and the other teachers didn’t know it.” He wrote at home “from morning to night, after every meal,” and his output was correspondingly large. In 2001 he listed 130 books written alone or with co-authors, plus 18 series of 228 titles that he edited.
The book that outlived the rest was C程序设计. Tan dates its first publication to 1990; Xue Fei (below) gives the first edition as 1991. It went through numerous editions: the fourth (2010) was rewritten around the C99 standard, and the fifth carries ISBN 978-7-302-48144-7. It became a standard text for first programming courses at Chinese universities and for students preparing for the national computer examinations. Kernighan and Ritchie’s The C Programming Language was the reference abroad; in China it was Tan’s book.
The sales figures have grown with every retelling, and all of them come from Tan or his publisher:
| Year | Copies of C程序设计 claimed | Source |
|---|---|---|
| 2000 | 3.3 million | Tan, in Tsinghua University news |
| 2001 | 3.3 million | Tan, in Guangming Daily |
| 2010 | 7 million | publisher’s author biography, 4th edition |
| 2025 | 17 million | Tan, interview with The Paper |
In 2000 Tan, writing for Tsinghua’s news site, called 3.3 million “a world record for a book of its kind,” and in 2001 Tan wrote that “some people say I have set three world records”: for the BASIC book’s sales, for the number of computer books written, and for the total of about 44 million copies across everything he had written or edited. No auditing body is named for any of them. In the same article he noted that the newspaper China Computerworld (计算机世界) had ranked him second among the ten people who most influenced Chinese IT in the twentieth century.
The Critics
As the readership grew, so did the list of complaints, almost all of it written by programmers who had learned from the book. Two examples recur. Critics point to void main() in the book’s programs, which many compilers accept but the C standard does not define for hosted programs, where main returns int. More notorious are the exercises that ask students to predict the result of expressions such as (++i)+(++i)+(++i), which modify the same variable several times without an intervening sequence point. The C standard leaves such code undefined (see Fun Fact: C Undefined Behavior): the compiler may produce any value. One 2015 blog post ran the book’s example and got 22 with gcc where the book said 24. Other critics fault the book’s single-letter variable names, inconsistent indentation, and math-exercise drills, which they argue train students for exams rather than for writing maintainable code.
The criticism reached print from Tan’s own publisher. In October 2012 Tsinghua University Press issued 品悟C: 抛弃C程序设计中的谬误与恶习 (Understanding C: Abandoning the Fallacies and Bad Habits of C Programming) by Xue Fei, 502 pages on common C errors; in a review of his own book on Douban, Xue traced one example, a+=a-=a*a, back to the 1991 first edition of Tan’s text. Xue’s book was itself received badly by readers. In January 2023, during an online wave of complaints about Chinese university textbooks, Tan’s C book was again one of the most named, with users repeating that “the domestic computer exams only recognize Tan Haoqiang’s textbook.”
Tan has not answered the programmers point by point. In 2025 he described his work this way: “It is not high, precise, and cutting-edge; it is popularization. Not a monograph, but popularization.”
Readers
The readers who stopped him in the street were not the ones writing blog posts. On a trip to Wuhan a father and daughter asked for a photograph, explaining that three generations of their family had learned from his books. In the Shuang’an shopping mall in Beijing a woman pulled at his sleeve from behind, asked whether he was Teacher Tan, and put a programming question to him on the spot. When a reader in Tianjin wrote that he could not find the book in any shop, Tan bought three copies and mailed them, so the reader could pass two on.
📚 Sources
- Liu Niankai and Xiao Peng: “数字底稿|千万读者的计算机启蒙者:专访清华教授谭浩强” (The Paper, 26 October 2025; interview recorded 1 October 2025) (birth year, Tsinghua career, BASIC and TV lectures, Beijing Union University, sales claims of 2025, retirement, reader anecdotes)
- Tan Haoqiang: “谭浩强:‘双肩挑’助我创造世界纪录” (Guangming Daily, 16 April 2001, reprinted by Tsinghua University) (one million viewers, BASIC sales claim, “three world records,” China Computerworld ranking, committee posts)
- Tan Haoqiang: “我与清华出版社的不解之缘” (Tsinghua University news, 20 September 2000) (3.3 million copies since 1990, “world record” claim)
- Xinhua: report on the 40th anniversary of the National Association of Fundamental Computer Education in Universities (22 October 2024) (founded 1984 by Xu Zhenyu, Tan Haoqiang, and others; Tan as honorary president)
- Tsinghua University Press: author page, Tan Haoqiang (honorary president of the association, NIT committee chair)
- National Diet Library: catalogue record, 谭浩强, 田淑清, 谢锡迎: BASIC语言 (科学普及出版社, 1980)
- Douban: catalogue record, 谭浩强: C程序设计 (第四版) (Tsinghua University Press, June 2010, ISBN 9787302224464) (C99 revision; publisher’s author biography with the 7 million figure)
- Douban: catalogue record, 薛非: 品悟C: 抛弃C程序设计中的谬误与恶习 (Tsinghua University Press, 2012, ISBN 9787302296263) (502 pages, October 2012, Xue’s review on the 1991 first edition, reader ratings)
- Douban: catalogue record, 谭浩强: C程序设计 (第五版) (Tsinghua University Press, 2017, ISBN 9787302481447)
- CSDN forum: “谁有c语言 谭浩强 的 【勘误表】” (thread, 1 June 2010) (readers on
void mainthroughout the book) - cppreference: Order of evaluation (C) (unsequenced modifications are undefined behavior)
- cppreference: Main function (C) (
mainreturnsintin a hosted environment) - yangwang: “题外话、谭浩强与i++” (blog, 20 December 2015) (book’s result 24 against gcc’s 22)
- realityone: “谈谭浩强的C语言教材” (blog, 21 March 2014) (naming, indentation, and exercise-style criticism)
- 晖思: “关于大学教材,网友们发现了更多内情” (WeChat account 晖诚勿思, 24 January 2023, archived by China Digital Times) (the 2023 textbook complaints)