Feed Headline Animator

What is constant and explain its types

Constant: -

A fix or unchangeable value in the program is called a constant value. There are four types of constant in C language. (1)Integer constant (2) Real or Float constant (3) Character constant (d) String constant

(1) Integer constant: -

A numerical value without a decimal is called integer constant. Or A non-frictional (+,-) fix value is called integer constant. For example +225, -555, 500 etc.

(2) Real or Floating constant: -

A frictional (+,-) fix value is called real or floating constant or Numeric values that an integer as well as a decimal part are called real or floating constant. For example +25.32, -58.679, 28.321 etc.

(3) Character constant: -

A single character when it is enclosed in single quotes is called character constant. For example ‘a’, ‘1’, ‘M’ etc.

(4) String constant: -

The combinations of characters when those are enclosed in double quotes are called string constant. For example “Pakistan”, “Phone-0966” etc.

Posted by: Wasim Javed

What are identifier and its types

Identifier: -

An identifier is the name that presents a variable, constant, data types, function, or label in a program. In the C language, an identifier consists of a combination of alphanumeric characters, such that:

• The first is always a letter of the alphabet or an (_) underscore.

• The remaining can be any letter, numeric digit, or the underscore.

There are two types of identifier in C language.
(1) Standard identifier (2) User-define identifier

(1) Standard identifier: -

The names of defined operations in C language are called identifier. For example, scanf and printf represent input and output functions. These are the standard identifiers.

(2) User- defined identifier: -

These are the names that a programmer assigns to function, data type, variable, etc. in a program.


Posted by: Wasim Javed

Write the structure of data type and its memory size in C language

S.No Data type Format specifier Data range Memory occupied

1 Int % d -32768----- +32767 2 bytes

2 Long % ld -2147483648------ +2147483647 4 bytes

3 Float % f 3.4*10-38------- 304*10+38 4 bytes

4 Double % lf 107*10-108------ 1.7*10+108 8 bytes

5 Char % C -128------ +127 1 bytes


Posted by: Wasim Javed

Write advantages of C language

Advantages:-

1. As the syntax of C language is very easy and short so it is easier to understand at the begging stage.

2. As its syntax is like by machine language so it is also called middle level language.

3. It is modular programming.

4. It is portable language, portable means that one program witch be written in one computer can easily be run or checked on another computer.

5. It is graphical language that is why its modern version likes C++ and visual C etc. They are use in graphical programming.


Posted by: Wasim Javed

What is ampersand sign

Ampersand sign:-

When we input data with scanf ( ) function, then variable is joined with a special character and which is called ampersand sign and it is used for the address of that data and without this character we can not input any data in to variable.

Posted by: Wasim Javed

What is an input and output statement in C language

The input statement: -
Input is that statement which is used to give data to the variable in the program. For C language the main input statement is scanf ( ). It is used in the program will be as:

Scanf (“format specifier”, ampersand sign variable);

For example:

Scanf (“%d or %f or %c or %s”, &a);
%d format specifier is used for integer type data.
%f format specifier is used for real type data.
%c format specifier is used for character type data.
%s format specifier is used for string type data.
The symbol & (ampersand sign) is used with scanf ( ) function and it is used to show the address of data.

The output statement: -

The output statement is that statement is used to display the result on screen. For this purpose the function printf ( ) is used. We can use it
Printf (“Message”);
Printf (“format specifier”, variable);
Printf (“%d or %f or %w”, sum);

Posted by: Wasim Javed

Explain introduction and history of C language

Introduction: -

C is a programming language developed by Dennis Ritchie in 1972. Programs are structured by defining and calling functions. Program flow is controlled using loops, if statements and function calls. Input and output can be directed to the terminal or to files. Related data can be stored together in arrays structures. C allows the most precise control of input and output.

History of C language: -

C is a general purpose programming language. It was developed at AT&T Bell Laboratories, USA in 1972. It was designed and developed by Dennis Ritchie. It was based on an earlier computer language called B. The B language was developed by Ken Thompson in 1969-70. For this reason, earlier version of the C language was called K&R C (Kernighan and Ritchie C).

The C language is a simple, easy to learn and powerful language. As more and more people started using C language, need to standardize its rules was felt. To meet this need, the American National Standards Institute (ANSI) developed a standard for the C language in late 80s. This version of the C language is known as ANSI C.

Posted by: Wasim Javed

Difference between low and high level languages

Low level language: -

It is actually initial computer language. It is categorized into two types

(1) Machine language (2) Assembly

(1) Machine language: -

It is the directly computer understood language. That computer language with does not need convert into any other interface or language for the understanding of computer. This language consists of binary digit these are (0, 1).

(2) Assembly language: -

It is low level language but one step higher then machine language. This language is always needed to first convert in to machine language and then computer can understood it. For this purpose a converter program “Assembler”.
High level language: - The programming languages that are close to human language are called high level language. The instructions in those languages are more like human language. Unlike low level language, these languages are sassier to learn. These languages are BASIC, FORTRAN, COBEL, PASCAL, C, C ++, etc. These languages are used for writing application programs. Every high level language has its own set of rules for writing program.

These rules are called the syntax of the language. A program written in a high level language is called source program or source code. Source code cannot be run directly on the computer. It is first translated or converted into the machine language. The application that is used to convert a source program into machine program is called compiler.

Posted by: Wasim Javed