0% found this document useful (0 votes)
3 views

C_Unit1

The document provides an overview of computer systems, computing environments, types of computer languages, software development processes, flowcharts, number systems, and the C programming language. It explains various computing environments such as personal, time-sharing, client-server, distributed, grid, and cluster computing, as well as the software development life cycle (SDLC) phases. Additionally, it covers arithmetic operators, expressions, type conversions, and the structure of a C program.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

C_Unit1

The document provides an overview of computer systems, computing environments, types of computer languages, software development processes, flowcharts, number systems, and the C programming language. It explains various computing environments such as personal, time-sharing, client-server, distributed, grid, and cluster computing, as well as the software development life cycle (SDLC) phases. Additionally, it covers arithmetic operators, expressions, type conversions, and the structure of a C program.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

St.

PAUL’S DEGREE & PG COLLEGE


(Affiliated to Osmania University)
Street No. 8, Himayathnagar, Hyderabad. Ph.No: 27602533

Programming in C
UNIT_I

1) What is Computer system? Explain about Computing Environments?


A computer system is a basic, full-featured hardware and software configuration with
all the components needed to perform computing operations. It enables humans to input,
process, and output data effectively and systematically. It often consists of software and
hardware elements, including operating systems, programs, and drivers, as well as memory,
input/output devices, storage devices, and a central processing unit (CPU).

Computing Environments: It is a collection of computers which are used to process and


exchange information to solve various types of computing problems.
Types:
➢ Personal Computing Environment: In the personal computing environment, there is a
single computer system. All the system processes are available on the computer and
executed there. The different devices that constitute a personal computing environment
are laptops, mobiles, printers, computer systems, scanners etc.

➢ Time-sharing Computing Environment: The time sharing computing environment


allows multiple users to share the system simultaneously by using multitasking system.
Each user is provided a time slice and the processor switches rapidly among the users
according to it. Because of this, each user believes that they are the only ones using the
system.

➢ Client-Server Computing Environment: In client server computing, the client requests a


resource and the server provides that resource. A server may serve multiple clients at the
same time while a client is in contact with only one server. Both the client and server
usually communicate via a computer network but sometimes they may reside in the same
system.

➢ Distributed Computing Environment: A distributed computing environment contains


multiple nodes that are physically separate but linked together using the network. All the
nodes in this system communicate with each other and handle processes. Each of these
nodes contains a small part of the distributed operating system software.

➢ Grid Computing Environment: Grid computing is a computing infrastructure that


combines computer resources spread over different
geographical locations to achieve a common goal. All unused resources on multiple
computers are pooled together and made available for a single task.

➢ Cluster Computing Environment: The clustered computing environment is similar to


parallel computing environment as they both have multiple CPUs. However a major
difference is that clustered systems are created by two or more individual computer
systems merged together which then work parallel to each other.

2) What are the types of Computer Languages?

A computer language have been evolved from low level to high level language.
➢ Machine language
➢ Assembly language
➢ High level language

➢ Low level language: A language that corresponds directly to a specific


machine.Machine Language is the only language that is directly understood by the
computer. It does not need any translator program. We also call it machine code and it is
written as strings of 1’s (one) and 0’s (zero).
Eg: 10010011111
➢ Middle level language: It uses only letters and symbols. Programming is simpler and
less time consuming than machine language programming. It is easy to locate and correct
errors in Assembly language. It is also machine-dependent. The programmer must have
knowledge of the machine on which the program will run. An assembler is a program
that translates an assembly language program into a machine language program.
Eg: ADD A,B

➢ High level language: High level language is the upper level language and also known as
third generation programming language. It does consider as high level because, which
language comes under this category are closer to human languages. Hence this is highly
understood programming language by human. There have many examples of high level
languages such as, FORTRAN, Pascal, C, C++, JAVA, ADA, COBOL, LISP, Prolog etc.
Eg: C = A + B;
3) Discuss about Software Development and flowcharts?

Software Development: SDLC is a process that creates a structure of development of


software. There are different phases within SDLC, and each phase has its various activities.
It makes the development team able to design, create, and deliver a high-quality product.

Phases of Software Development:

➢ Requirement gathering and analysis:


This phase involves gathering information about the software requirements from
stakeholders, such as customers, end-users, and business analysts.
➢ Design: In this phase, the software design is created, which includes the overall
architecture of the software, data structures, and interfaces. It has two steps:
• High-level design (HLD): It gives the architecture of software products.
• Low-level design (LLD): It describes how each and every feature in the product
should work and every component.

➢ Implementation or coding: The design is then implemented in code, usually in several


iterations, and this phase is also called as Development.
things you need to know about this phase:
✓ This is the longest phase in SDLC model.
✓ This phase consists of Front end + Middleware + Back-end.
✓ In front-end: Development of coding is done even SEO settings are done.
✓ In Middleware: They connect both the front end and back end.
✓ In the back-end: A database is created.

➢ Testing: The software is thoroughly tested to ensure that it meets the requirements and
works correctly.
➢ Deployment: After successful testing, The software is deployed to a production
environment and made available to end-users.
➢ Maintenance:This phase includes ongoing support, bug fixes, and updates to the
software.

Flowcharts:
✓ A flowchart is a diagram that depicts a process, system or computer algorithm. They
are widely used in multiple fields to document, study, plan, improve and communicate
often complex processes in clear, easy-to-understand diagrams.
✓ Flow charts, use rectangles, ovals, diamonds and potentially numerous other shapes to
define the type of step, along with connecting arrows to define flow and sequence.
✓ In other word a pictorial representation of a textual algorithm is done using a
flowchart.It is a pictorial representation of algorithm.
4) What is Number system?Explain about Binary, Octal, hexadecimal
number system?

➢ Number System: The number system or the numeral system is the system of
naming or representing numbers. We know that a number is a mathematical
value that helps to count or measure objects and it helps in performing various
mathematical calculations. There are different types of number systems in
Maths like decimal number system, binary number system, octal number
system, and hexadecimal number system.

➢ Binary number system: The base of the binary number system is 2 it uses
only two digits-0 and 1.Data represented in the computer system by either the
presence or absence of electronic signals.In the binary system all number
expressed as a groups of binary digits i.e, groups of 0’s and 1’s.The value are
based on the right or left position of digits in a binary number,using power of
2 as position value.

➢ Octal number system: Octal number refers to the base - 8 number


system,which use just eight unique symbols(0,1,2,3,4,5,6,7) .In Octal
format,each digit represents three binary digits such as following table:

Octal Binary
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111

➢ Decimal number system: The base or radix of a number system is defined as


the number of digits used to represent the number of digits such to represent
the number in the system.Since decimal number system uses 10 digits - 0
through 9. Its base or radix is 10.The weight of each digit of a decimal
number system depends on its relative position within the number.

➢ Hexadecimal number system: The word hexadecimal can be divided into 'Hexa' and
'deci', where 'Hexa' means 6 and 'deci' means 10. The hexadecimal number system is
described as a 16 digit number representation of numbers from 0 - 9 and digits from A -
F. In other words, the first 9 numbers or digits are represented as numbers while the next
6 digits are represented as symbols from A - F.
5) What is C language? Explain about Background and C program?

✓ C is a computer programming language used to design computer software and


applications.
✓ C programming was invented in the year 1972 by Dennis Ritchie.He was an American
Computer Scientist worked at Bell Labs.
✓ He is said to be the Father of C.
✓ Applicatiosn used to create and execute C programs are
✓ Turbo C
✓ Turbo C++
✓ GNU C
✓ Code Blocks.
✓ Net Beans.
✓ C is the general purpose language which has been closely associated with UNIX
operating system.
✓ Many important ideas of C stem from the langugage BCPL.

Basic structure of C program:

➢ Documentation Section: This section consists of the description of the program, the
name of the program, and the creation date and time of the program. It is specified at the
start of the program in the form of comments. Documentation can be represented as:
✓ // description, name of the program, programmer name, date, time etc.-------For single
line.
✓ /* description, name of the program, programmer name, date, time etc.*/--------- For
multiple lines.
✓ Anything written as comments will be treated as documentation of the program and this
will not interfere with the given code. Basically, it gives an overview to the reader of the
program.

➢ Link section/Preprocessor Section:


✓ All the header files of the program will be declared in the preprocessor section of the
program. Header files help us to access other’s improved code into our code. A copy of
these multiple files is inserted into our program before the process of compilation.

Example:
#include<stdio.h>
#include<math.h>

➢ Definition:Preprocessors are the programs that process our source code before the
process of compilation. There are multiple steps which are involved in the writing and
execution of the program. Preprocessor directives start with the ‘#’ symbol. The #define
preprocessor is used to create a constant throughout the program. Whenever this name is
encountered by the compiler, it is replaced by the actual piece of defined code.
Example:
#define PI 3.1415

➢ Global Declaration: The global declaration section contains global variables, function
declaration, and static variables. Variables and functions which are declared in this scope
can be used anywhere in the program.
Example:
int num = 18;

➢ Main( ) Function: Every C program must have a main function. The main( ) function of
the program is written in this section. Operations like declaration and execution are
performed inside the curly braces of the main program. The return type of the main( )
function can be int as well as void too. void( ) main tells the compiler that the program
will not return any value. The int main( ) tells the compiler that the program will return
an integer value.
Example:
void main( )
or
int main( )

➢ Sub Programs:
User-defined functions are called in this section of the program. The control of the program
is shifted to the called function whenever they are called from the main or outside the main()
function. These are specified as per the requirements of the programmer.
Example:
int sum(int x, int y)
{
return x+y;
}

6) Discuss about Arithmetic operators and Expressions?

✓ Operators can be defined as the symbols that help us to perform specific mathematical,
relational, bitwise, conditional, or logical computations on operands.
✓ Arithmetic operators are used to perform arithmetic operations.
✓ Arithmetic operators are classified as:
✓ Integer Arithmetic.
✓ Real Arithmetic.
✓ Mixed mode arithmetic.

➢ Integer Arithmetic: In this type of operation both the operands are integer in an integer
arithmetic.It always yields an integer value.
Syntax: exp1 Integerarithmetic exp2
Eg: a+b

➢ Real Arithmetic: In this type of operation,both the operands are real in real arithmetic.It
yields real values as result.It cannot be applied for % operator.
Syntax: exp2 real arithmetic exp2
Eg: float a = 20.0,b = 3.0; a+b= 23.000000

➢ Mixed Mode Arithmetic: In this type of operation,one operand is integer and other is
real.Here the result will always be real.
Syntax: exp1 mixedmode arithmetic exp2
Eg: int a = 20.0,b = 3; a+b = 23.0

Expression:
➢ An expression is a collection of operators and operands that represents a specific value.
➢ An Operator is a symbol that performs tasks like arithmetic operations,logical and
conditional operations.
➢ Operands are the values on which the operators perform the task.Here operand can be
direct value or variable or address of memory location.
Types:

➢ Infix: The expression in which the operator is used between operands is called infix
expressions.
Eg: a+b
➢ postfix: The expression in which the operator is used after operands is called postfix
expression.
Eg: ab+

➢ Prefix: The expression in which the operator is used before operands is called a prefix
expression
Eg: +ab

Expression evaluation:
✓ In c language an expression is evaluated based on the operator precedence and
associativity.
✓ When there are multiple operators in an expression they are evaluated according to their
precedence and associativity.
✓ The operator which has the highest precedence is evaluated first and the operator with the
least precedence is evaluated last.
✓ An expression is evaluated based on the precedence and associativity of the operators in
that expression.
✓ Consider the following Statements:
y = a – b / ( 3 + c) * (2 -1 );
when a = 10, b = 12 and c = 3
y = 10 – 12 / (3 + 3 ) * (2 -1) is evaluated as follows:
Step 1 : y = 10 - 12 / 6 * ( 2 -1)
Step 2 : y = 10 - 12 / 6 * 1
Step 3: y = 10 - 2 * 1
Step 4: y = 10 - 2
Step 5: y = 8

❖ Operator Precedence in C:
✓ Operator precedence determines which operation is performed first in an expression with
more than one operator with different precedence.
✓ 10 + 20 * 30
✓ The expression contains two operators, + (plus), and * (multiply). According to the given
table, the * has higher precedence than +

❖ Operator Associativity:
✓ Operator associativity is used when two operators of the same precedence appear in an
expression. Associativity can be either from Left to Right or Right to Left.
✓ 100 / 5 % 2
✓ Both / (division) and % (Modulus) operators have the same precedence, so the order of
evaluation will be decided by associativity.
✓ According to the given table, the associativity of the multiplicative operators is from Left
to Right. So,

➢ (100 / 5) % 2
➢ After evaluation, the expression will be
➢ 20 % 2
➢ Now, the % operator will be evaluated.
➢ 0

7) Explain abput Type Conversions?

➢ Type conversion:
The type conversion is the process of converting a data value from one datatype to another
datatype automatically by the compiler.It is also called as Implicit type conversion or
Automatic type conversion.
Eg: #include<stdio.h>
#include<conio.h>
void main( ){
int i =95;
float x = 90.00;
char ch = ‘A’;

i = x;
printf(“i value is %d\n:”,i);
x = i;
printf(“ x value is %f\n:”,x);
i = ch;
printf(“ i value is %c:”,i);
}
O/P:
i value is : 90
x value is : 90.000000
I value is: 65
➢ Typecasting:
✓ Also called Explicit type conversion.Compiler converts data from one datatype to
another dataatype implicitly.
✓ When compiler converts implicitily there may be data loss.
✓ In such cases convert the data from one datatype to another data type using explicit type
conversion.
✓ (TargetDataType) DataValue

Eg: #include<stdio.h>
int main( ) {
// create an integer variable
int number = 35;
printf("Integer Value: %d\n", number);
// explicit type conversion
double value = (double) number;
printf("Double Value: %.2lf", value);
return 0;
}
O/P: Integer Value: 35
Double Value: 35.00
8) How to Create and run C program?

➢ Writing/Editing: A program can be written in any text editor like notepad.After


writing a program ,it must be saved.In C language the program is saved with
the extension “.c”.This is the source program written in high level language.

➢ Compilation: After writing and saving the source program,the next step is
compilation.Here we will use a software called as compiler,which converts a
program written in high level language into machine language.The resulatant
file is known as object file in c.The extension is “.obj”.

➢ Linking: Here the software called Linker is used.The linker links the program
with external library files which contains the code for predefined fucntions
and creates an executable file.The extension of the executable file is “.exe”.

➢ Execution: The Operating system executes the executable file which is the
machine code with the help of the CPU and other hardware components.
9) Rules for writing C program?

➢ C is a case-sensitive language so all C instructions must be written in lower case letters.


main is not the same as MAIN.
➢ The symbolic constants can be written in Uppercase letters.
➢ Eg: #define TOTAL 50
➢ All C statements must end with a semicolon.
➢ Whitespace is used in C to add blank space and tabs.
➢ When we write a function, its body is enclosed in curly braces, like for the main( )
function. We will learn this in detail when we cover functions.
➢ A semicolon ; is used to mark the end of a statement and the beginning of another
statement in the C language.

10) Explain about Identifiers?

✓ C identifiers represent the name in the C program.An identifier can be composed of


letters such as uppercase, lowercase letters, underscore, digits, but the starting letter
should be either an alphabet or an underscore.
✓ for example, variables, functions, arrays, structures, unions, labels, etc.
✓ In other words, an identifier can be defined as the user defined name to identify an entity
uniquely.
✓ Eg: int marks;
✓ char studentName[30];
✓ Here marks and studentName are identifiers.

Rules for creating Identifiers:


➢ The first character of an identifier should be either an alphabet or an underscore, and then
it can be followed by any of the character, digit, or underscore.
➢ It should not begin with any numerical digit.
➢ In identifiers, both uppercase and lowercase letters are distinct. Therefore, we can say
that identifiers are case sensitive.
➢ Commas or blank spaces cannot be specified within an identifier.
➢ Keywords cannot be represented as an identifier.
➢ The length of the identifiers should not be more than 31 characters.
➢ Identifiers should be written in such a way that it is meaningful, short, and easy to read.
➢ Eg: total, sum, average, _m _, sum_1, etc.

11) Explain about Datatypes?

➢ A data type specifies the type of data that a variable can store such as integer, floating,
character, etc.
➢ This datatype specifies how much memory is to be allocated and what type of values to
be stored in the variable or constant or array.
➢ Basic/Primary/Predefined datatype:
➢ The basic data types are integer-based and floating-point based. C language supports
both signed and unsigned literals.
➢ The memory size of the basic data types may change according to 32 or 64-bit operating
system.

⚫ Integer Data Type:


➢ The integer datatype in C is used to store the whole numbers without decimal values.
Octal values, hexadecimal values, and decimal values can be stored in int data type in C.
➢ Range: -2,147,483,648 to 2,147,483,647
➢ Size: 4 bytes
➢ Format Specifier: %d
➢ Syntax: int var_name;
➢ The integer data type can also be used as:
➢ unsigned int: Unsigned int data type in C is used to store the data values from zero to
positive numbers but it can’t store negative values like signed int.
➢ short int: It is lesser in size than the int by 2 bytes so can only store values from –32,768
to 32,767.
➢ long int: Larger version of the int datatype so can store values greater than int.
➢ unsigned short int: Similar in relationship with short int as unsigned int with int.
⚫ Float Data Type:
➢ In C programming float data type is used to store floating-point values. Float in C is used
to store decimal and exponential values. It is used to store decimal numbers (numbers
with floating point values) with single precision.
➢ Range: 1.2E-38 to 3.4E+38
➢ Size: 4 bytes
➢ Format Specifier: %f
➢ Syntax: float var_name;

⚫ Double Data Type:


➢ A Double data type in C is used to store decimal numbers (numbers with floating point
values) with double precision. It is used to define numeric values which hold numbers
with decimal values in C.
➢ The double data type is basically a precision sort of data type that is capable of holding
64 bits of decimal numbers or floating points. Since double has more precision as
compared to that float then it is much more obvious that it occupies twice the memory
occupied by the floating-point type. It can easily accommodate about 16 to 17 digits after
or before a decimal point.
➢ Range: 1.7E-308 to 1.7E+308
➢ Size: 8 bytes
➢ Format Specifier: %lf
➢ Syntax: double var_name;

⚫ Character Data Type:


➢ Character data type allows its variable to store only a single character. The size of the
character is 1 byte. It is the most basic data type in C. It stores a single character and
requires a single byte of memory in almost all compilers.
➢ Range: (-128 to 127) or (0 to 255)
➢ Size: 1 byte
➢ Format Specifier: %c
➢ Syntax: char var_name;

⚫ Derived Datatypes: The data-types that are derived from the primitive or built-in
datatypes are referred to as Derived Data Types. These can be of four types namely:
Arrays,functions and Pointer.
⚫ Enumerated Datatype: Enumeration (or enum) is a user defined data type in C. It is
mainly used to assign names to integral constants, the names make a program easy to
read and maintain.
Syntax: enum flag {const_name1, const_name2, ..., const_nameN};

⚫ Void Datatype: It means nothing or no value.Generally the void is used to specify a


function which does not return any value.The void datatype is used to specify empty
parameters of a function.

12) Explain about Variable and constant?

⚫ Variable: A variable in C is a memory location with some name that helps to store some
form of data and retrieves it when required. We can store different types of data in the
variable and reuse the same variable for storing some other data any number of times.
➢ syntax: data_type variable_name = value; // defining single variable
or
➢ data_type variable_name1, variable_name2; // defining multiple variable

➢ A variable name should not start with a digit.


➢ Keywords should not be used as variable names.
➢ A variable name should not contain any special symbols except underscore( _ ).
➢ A variable name can be of any length but compiler considers only the first 31 characters
of the variable name.

⚫ Constants:
➢ Constant is a value that cannot be changed during program execution; it is fixed.
➢ In C language, a number or character or string of characters is called a constant. And it
can be any data type. Constants are also called as literals.
➢ Integer constants: An integer constant can be decimal integer or octal integer or
hexadecimal integer.A decimal integer value is specified as direct integer and should not
start with zero.
➢ whereas octal integer value is prefixed with ‘0’ and must start with zero.
➢ Hexadecimal value is prefixed with ‘0X’ or ‘0x’

➢ Floating point constants: Floating point constant must contain both integer and decimal
parts.
➢ It can also contain the exponent part.
➢ 3.14 prepresented as 3E-14
➢ Character constants: It is enclosed in single quotation.A character constant has a
maximum length of one character.
➢ Predefined character constants called escape sequences.EVery escape sequence has its
own functionality and every escape sequence is prefixed with ‘\’ symbol.

➢ String constants: It is a collection of characters, digits, special symbols and escape


sequences enclosed in double quotes.
➢ By using const keyword or by using #define preprocessor we can create a constant.

❖ In C programming language,constants can be created using two concepts.

➢ Using ‘const’ keyword: Of any datatype we can create a constant by using ‘const’
keyword.
➢ Syntax: const datatype constantName;
or
➢ const datatype constantName = value;

➢ Using ‘#define’ preprocessor: It must be defined at the beginning of the program.


➢ Syntax: #define CONSTANT_NAME value

13) What are the various input and output statements in C programming
language?

✓ C language has standard libraries that allow input and output in a program. The stdio.h or
standard input output library in C that has methods for input and output.
✓ The input operations are used to read user values from the keyboard.

Formatted I/O in C:
➢ The I/O procedure is known as "formatted I/O". It enables you to read or write data in a
certain format.
➢ Printf() and scanf() are two examples of C routines that handle formatted I/O. The type
and format of the data to be read or written are specified by format strings, which are
used by these operations. The program's execution replaces the placeholders for the data
found in the format strings with the actual data.

Unformatted I/O in C:
➢ Unformatted I/O refers to a category of I/O operations that reads or writes data as a
stream of bytes without regard to any format. Unformatted I/O in C is carried out with
the aid of functions like fread() and fwrite(). Without formatting, these operations are
used to read and write data directly to and from files.
⚫ scanf( ): This function is used to read multiple data values of different datatypes from the
keyboard.
syntax: scanf(“format specifier”, &variableNames);
Eg: scanf(“%d”,&i);

✓ The ‘%’ indicates that the conversion specification.


✓ The ‘d’ represents the data type and indicates that the number should be read as a integer.
✓ The ‘&’ is ‘C’ Language unary operator that gets the memory address of the variable

Eg: //scanf( ) & printf( )

#include <stdio.h>
int main( ) {
char str[100];
int i;
printf( "Enter a value :");
scanf("%s %d", str, &i);
printf( "\nYou entered: %s %d ", str, i);
return 0;
}
O/P: Enter a value : seven 7
You entered: seven 7

⚫ getchar( ) : getchar( ) function is used to read one character at a time from the key board.
Syntax ch = getchar( ); where ch is a char Var
✓ When this function is executed, the computer will wait for a key to be pressed and
assigns the value to the variable when the “enter” key pressed.

Eg: //getchar( ) & puchar( ):

#include <stdio.h>
int main( ) {
int c;
printf( "Enter a value :");
c = getchar( );
printf( "\nYou entered: ");
putchar( c );
return 0;
}
O/P: Enter a value : this is test
You entered: t

⚫ getch( ): It is similar to getchar function.The getch( ) function is used to read a character


from the keywordand return it to the program.
✓ This function is used to read a singlle character.
✓ It will not display/ecode on the screen directly it will go to next line and there it will
display the result.
✓ It also used to hold the screen of the program.

Eg: //getch( )
void main( ){
char ch;
printf(“\n Enter any character:”);
ch = getch( );
printf(“\n You have entered:%c”,ch);
}
O/P: Enter any character:
You have entered: S

⚫ gets( ): gets( ) function is used to read a string of characters including white spaces.
✓ Note that white spaces in a string cannot be read using scanf( ) with %s format specifier.
Syntax: gets (S); where ‘S’ is a char string variable.
✓ When this function is executed the computer waits for the string to be entered.
Eg: gets( ) & puts( )
#include <stdio.h>
int main( ) {
char str[100];
printf( "Enter a value :");
gets( str );
printf( "\nYou entered: ");
puts( str );
return 0;}
O/P:
Enter a value : this is test
You entered: this is test
⚫ fscanf( ): This is used with the file concept of files. The fscanf( ) is used to read data
values from a file. When we want to use fsanf( ) function the file must be opened in
reading mode.

⚫ printf( ) function: The printf ( ) function, part of the standard C library, is the most
versatile way for a program to display data onscreen.
✓ Printing a text message onscreen is simple.
✓ Call the printf( ) function, passing the desired message enclosed in double quotation
marks.
✓ For example, to display an error that has occurred! onscreen, the user write the following:
✓ printf("An error that has occurred!");
✓ It accepts a string parameter (called the format string), which specifies a method for
rendering a number of other parameters into a string.

⚫ putchar( ): putchar( ) function is used to display one character at a time on the monitor.
Syntax: putchar (ch);
✓ The Computer display the value char of variable ‘ch’ i.e M on the Screen.

⚫ puts( ): puts( ) is a function used to display strings on screen.


Syntax: puts (S); where ‘S’ is a char string variable.
✓ When this function is executed the computer waits for the string to be entered and then
display the entered string on the screen.

⚫ fprintf( ): It is used with the concept of files.The fprintf( ) function is used to print a line
into the file.When we want to use this function the file must be opened in writing mode.

You might also like