BookPDF Available

A Text Book of C Programming

Authors:

Abstract

The programming languages have become important to develop computer programs. It is essential to write efficient programs in order to solve all simple to complex problems. An efficient and powerful high level language like C helps to solve large and complex problems in reasonable time. Learning C as a programming language is the first step for those who want to enter the profession of computer programming. As the programming language C gives standard construct, it is easier to learn any other language if one has a clear concept of C. This book “A Textbook of C programming” is written as a course book for B.E, B.I.T, B.C.A., B.B.A., B.I.M., and intermediate level of various universities of Nepal. This is a complete book in C programming language to assist students in learning process. The book focuses on theory as well as programming examples to facilitate students on programming using C. The entire book is divided into fourteen chapters and appendices. Each chapter has been presented with detail explanation of relevant theory topics, immediate examples to illustrate the related theory, a number of solved examples and exercises to enhance analytical skills. It contains more than 200 solved examples which help to familiarize the readers with many problems and write programs to solve them. Chapter fourteen is the dedicated chapter which covers all about the programming concepts with FORTRAN. This FORTRAN programming concepts shall be helpful for all and especially to Institute of Engineering (IOE) students who have to study FORTRAN with C Programming as a course in their syllabus. In addition with the syllabus chapters, it provides appendix for Frequently Asked Questions (FAQ) which will be beneficial to get clear concepts, guidelines in project development in C with sample projects, programming lab sheets suitably designed to perform lab activities for a maximum of 2.5 hours lab per week in the university colleges. We proudly say that “TEXT BOOK OF C PROGRAMMING” has been published with its revised edition to meet the expectation of professors/lecturers as well as students and fulfill the course requirements of all the universities of Nepal and abroad.
A preview of the PDF is not available
55 3.1.1 Letter or Alphabets
  • Character Set
Character Set.......................................................................................................................... 55 3.1.1 Letter or Alphabets...................................................................................................... 55 3.1.2 Digits........................................................................................................................... 55 3.1.3 Special Characters....................................................................................................... 55
101 4.13.1 Implicit Type Conversion
  • ........................................................................................................................................................................................................................................ Data Type Conversions In Expressions
Data Type Conversions in Expressions................................................................................ 101 4.13.1 Implicit Type Conversion......................................................................................... 101 4.13.2 Explicit Type Conversion......................................................................................... 102
135 6.1.1 if Statement
  • .............................................................................................................................................................................................................. Statement.................................................................................................. Statement.................................................................................................... Statement........................................................................................................................................... Decision Making Statements
Decision Making Statements................................................................................................. 135 6.1.1 if Statement............................................................................................................... 135 6.1.2 Nested if Statement................................................................................................... 137 6.1.3 if…else Statement..................................................................................................... 138 6.1.4 Nested if..else Statement........................................................................................... 140 6.1.5 if…else if Statement.................................................................................................. 143 6.2
Library Functions (Built-in Functions)
  • Library Functions....................................................................................................................................................... User-Defined
User-Defined and Library Functions..................................................................................... 200 7.3.1 Library Functions (Built-in Functions)..................................................................... 200
206 7.5.2 Functions with Arguments but no Return Value Function with arguments and return values
  • .................................................................................................................................................................. Values
7.5.1 Functions with no Arguments and no Return Values................................................ 206 7.5.2 Functions with Arguments but no Return Value....................................................... 207 7.5.3 Function with arguments and return values............................................................... 208
Function call by value (or Pass arguments by value)
  • Different Types Of Function Calls
Different Types of Function Calls......................................................................................... 209 7.6.1 Function call by value (or Pass arguments by value)................................................ 209 7.6.2 Function Call by Reference (Pass Argument by Address)........................................ 210
244 8.3.1 Declaration of two-dimensional array
  • ................................................................................................................................................................................................ Multi-Dimension Arrays
Multi-Dimension Arrays......................................................................................................... 244 8.3.1 Declaration of two-dimensional array....................................................................... 244 8.3.2 Initialization of multi-dimensional array................................................................... 245
328 10.11.2 Passing an entire structure to a function
  • Function
  • .............................. . Structure
Function and Structure......................................................................................................... 328 10.11.1 Passing structure members to a function................................................................ 328 10.11.2 Passing an entire structure to a function................................................................. 329 10.11.3 Passing Structure pointer to a function................................................................... 330 10.11.4 Passing an array of structure to a function.............................................................. 332
372 11.5 Library Functions for Reading
  • File Opening
File Opening Modes.............................................................................................................. 372 11.5 Library Functions for Reading/Writing from/to a File............................................................. 373 11.5.1 String Input/Output................................................................................................. 373 11.5.2 Character Input/Output........................................................................................... 375 11.5.3 Formatted Input/Output.......................................................................................... 379
372 11.5 Library Functions for Reading/Writing from/to a File
  • Chapter
Chapter -11 Data Files........................................................................................... 370 11.1 Introduction........................................................................................................................... 370 11.2 Disk File I/O.......................................................................................................................... 370 11.3 Opening and Closing a File................................................................................................... 372 11.4 File Opening Modes.............................................................................................................. 372 11.5 Library Functions for Reading/Writing from/to a File............................................................. 373 11.5.1 String Input/Output................................................................................................. 373 11.5.2 Character Input/Output........................................................................................... 375 11.5.3 Formatted Input/Output.......................................................................................... 379