Archive for Characteristics of C

You are browsing the archives of Characteristics of C.

C Structures and Unions

A structure is a collection of variables under a single name. These variables can be of different types, and each has a name which is used to select it from the structure. A structure is a convenient way of grouping several pieces of related information together.
Declaring Structures

struct mystruct
{
int numb;
[...]

C Strings

Character type array is called string. All strings end with the NULL character. Use the %s placeholder in the printf() function to display string values.
Declaration:
char name[50];
Example

#include <stdio.h>
void main (void )
{
char *st1 = "abcd";
char st2[] = "efgh";
printf( "%s\n", s1);
[...]

C Loops

Loops are used to repeat one statement or set statements more than one time. Most real programs contain some construct that loops within the program, performing repetitive actions on a stream of data or a region of memory. There are several ways to loop in C.
For Loop
For loop is a counter loop. The for loop [...]

C Order of Precedence

It is necessary to be careful of the meaning of such expressions as a + b * c
We may want the effect as either
(a + b) * c
or
a + (b * c)
All operators have a priority, and high priority operators are evaluated before lower priority ones. Operators of the same priority are evaluated from [...]

C Operators

Arithmetic Operators
As well as the standard arithmetic operators (+ – * /) found in most languages, C provides some more operators. There are some notable differences with other languages, such as Pascal.
Assignment is = i.e. i = 4; ch = `y’;
Increment ++, Decrement — which are more efficient than their long hand [...]

C Variables

C has the following simple data types:

C type
Size (bytes)
Lower bound
Upper bound

Char
1
—–
——

Unsigned char
1
0
[...]

First Program

Here is your first c program. Write carefully because C Language is a case sensative language.

#include < stdio.h>
void main()
 
{
printf("Hello World\n");
}

Press ALT+F9 to compile your program. If you have any error in your program, you will get the message, remove your errors and then execute your program you will got the out [...]

Characteristics of C

We briefly list some of C’s characteristics that define the language and also have lead to its popularity as a programming language. Naturally we will be studying many of these aspects throughout the course.
• Small size
• Extensive use of function calls
• Loose typing — unlike PASCAL
• Structured language
• Low level (BitWise) programming readily available
• Pointer implementation – extensive use of [...]