The Format of C

Statements are terminated with semicolons. Indentation is ignored by the compiler. C is case sensitive – all keywords and Standard. Library functions are lowercase. Strings are placed in double quotes. Newlines are handled via \n Programs are capable of flagging success or error, those forgetting to do so have one or other chosen randomly!  

Merits of C Programming

1. C is a general purpose programming language. You can generate games, business software, utilities, mathematical models, word processors, spreadsheets and other kinds of software. 2. C is a structured programming language. It uses structured statements such as while, for loops in place of goto statements which cause bugs (error) in the program. 3. System independence- … Read more

a program to read the data for the customer, calculate the interest and service charge, and print the customer’s name, average balance, interest, and service charge.

//calculate interest and service charge for bank customer #include <stdio.h> int main() { char customer[30], acctNum[30]; double avgBalance, interest, service; int numTrans; printf(“Name? “); gets(customer); printf(“Account number? “); gets(acctNum); printf(“Average balance? “); scanf(“%lf”, &avgBalance); printf(“Number of transactions? “); scanf(“%d”, &numTrans); interest = avgBalance * 0.06; service = numTrans * 0.50; printf(“\nName: %s\n”, customer); printf(“Average balance: … Read more

Escape Sequences

Within the string argument to printf, the backslash (\) signals that a special effect is needed at this point. The character following the backslash specifies what to do. This combination (\ followed by another character) is referred to as an escape sequence. The following are some escape sequences you can use in a string in … Read more

character set of C

The character set of C comprises of wide range of symbols that can be used to create tokens. These symbols are available on all modern personal computers. These characters can be grouped into following categories: 1. Letters 2. Digits 3. Special Characters 4. White Spaces Table – 1 shows the complete set of characters supported … Read more

Advantages of C language

C language has in-numerous advantages. The important advantages of C language are described as follows: 1. Easy to Understand: C language is a structured programming language. The program written in C language is easy to understand and modify. 2. Middle Level Language: C language has combined features of low level language (such as assembly language) … Read more

Introduction to C Programming Language

In order to communicate any idea, thought, instruction or information, humans make use of spoken language. The fact is that you have just understood the very first sentence of this chapter all due to that. However, spoken languages are not understood by machines. Not only machines but also other living creatures of this planet do … Read more

Why is the C language important?

The following list illustrates the importance the C programming language, in no particular order: The C language is small and relatively easy to learn. C compilers can produce highly efficient code. C compilers and cross-compilers are widely available for a large array of hardware targets, from tiny eight-bit microcontrollers to giant mainframes. The availability of … Read more

If statement in C programming

When we need to execute a block of statements only when a given condition is true then we use if statement. In the next tutorial, we will learn C if..else, nested if..else and else..if. C – If statement Syntax of if statement: The statements inside the body of “if” only execute if the given condition … Read more