A function is a group of statements that together perform a task. Every C program has at least one function, which is main(), and all the most trivial programs can define additional functions. You can divide up your code into separate functions.
A function is a group of statements that together perform a task. Every C program has at least one function, which is main(), and all the most trivial programs can define additional functions. You can divide up your code into separate functions.
Importance of loops in any programming language is immense, they allow us to reduce the number of lines in a code, making our code more readable and efficient.
Operators and expressions in c languagetanmaymodi4
what is operator in c language
uses of operator in c language
syatax of operator in c language
program of operator in c language
what is expressions in c language
use of expressions in c language
syantax of expressions in c language
This C tutorial covers every topic in C with the programming exercises. This is the most extensive tutorial on C you will get your hands on. I hope you will love the presentation. All the best. Happy learning.
Feedbacks are most welcome. Send your feedbacks to dwivedi.2512@gmail.com. You can download this document in PDF format from the link, http://www.slideshare.net/dwivedi2512/learning-c-an-extensive-guide-to-learn-the-c-language
Array
Introduction
One-dimensional array
Multidimensional array
Advantage of Array
Write a C program using arrays that produces the multiplication of two matrices.
Type Conversion, Precedence and AssociativityAakash Singh
This presentation is about Type Conversion, Precedence and Associativity which are important concepts for problem solving in programming languages like C, C++, Java, etc. It will surely help you to improve your knowledge.
This Presentation gives you all knowledge about #CPointers, #PointersInC.
The given slides are as follows:
1. Introduction of Pointers.
2. Systems to create a pointer in C.
3. Valid Pointer Examples in C.
4. Graphical representation of address assigning in c using pointer.
5. 1st Sample program of pointers in C.
6. Types of Pointers
7. NULL Pointer in C (Types of Pointer)
8. void Pointer in C (Types of Pointer)
9. Wild Pointer in C (Types of Pointer)
10. Changing value of variable using pointer
11. Update and Access value of variable using pointer in example.
12. Types of format specifies to print address in different format.
13. Advantages of Pointer in C.
14. Disadvantages of Pointer in C.
15. Pointers with Array using Programs. #pointerwitharray
16. Another Example of #pointerwitharray.
17. Relationship Between Arrays and Pointers.
18. Relationship Between Arrays and Pointers explanation with diagram.
19. Pointers and String. #PointersAndString
20. Function with Array Parameters using pointers.
21. Passing Pointers to Function or Pointer argument function. #PointerWithFunction
Importance of loops in any programming language is immense, they allow us to reduce the number of lines in a code, making our code more readable and efficient.
Operators and expressions in c languagetanmaymodi4
what is operator in c language
uses of operator in c language
syatax of operator in c language
program of operator in c language
what is expressions in c language
use of expressions in c language
syantax of expressions in c language
This C tutorial covers every topic in C with the programming exercises. This is the most extensive tutorial on C you will get your hands on. I hope you will love the presentation. All the best. Happy learning.
Feedbacks are most welcome. Send your feedbacks to dwivedi.2512@gmail.com. You can download this document in PDF format from the link, http://www.slideshare.net/dwivedi2512/learning-c-an-extensive-guide-to-learn-the-c-language
Array
Introduction
One-dimensional array
Multidimensional array
Advantage of Array
Write a C program using arrays that produces the multiplication of two matrices.
Type Conversion, Precedence and AssociativityAakash Singh
This presentation is about Type Conversion, Precedence and Associativity which are important concepts for problem solving in programming languages like C, C++, Java, etc. It will surely help you to improve your knowledge.
This Presentation gives you all knowledge about #CPointers, #PointersInC.
The given slides are as follows:
1. Introduction of Pointers.
2. Systems to create a pointer in C.
3. Valid Pointer Examples in C.
4. Graphical representation of address assigning in c using pointer.
5. 1st Sample program of pointers in C.
6. Types of Pointers
7. NULL Pointer in C (Types of Pointer)
8. void Pointer in C (Types of Pointer)
9. Wild Pointer in C (Types of Pointer)
10. Changing value of variable using pointer
11. Update and Access value of variable using pointer in example.
12. Types of format specifies to print address in different format.
13. Advantages of Pointer in C.
14. Disadvantages of Pointer in C.
15. Pointers with Array using Programs. #pointerwitharray
16. Another Example of #pointerwitharray.
17. Relationship Between Arrays and Pointers.
18. Relationship Between Arrays and Pointers explanation with diagram.
19. Pointers and String. #PointersAndString
20. Function with Array Parameters using pointers.
21. Passing Pointers to Function or Pointer argument function. #PointerWithFunction
The root of all modern language is ALGOL (Algorithmic Language), introduced in the early 1969s. ALGOL was the first computer language to use a block structure. In 1967, Martin Richards developed a language called BCPL (Basic Combined Programming Language) primarily for writing system software. In 1970, Ken Thompson created a language using main features of BCPL and called it simply B. B was used to create early version of UNIX operating system at Bell Laboratories. C was evolved from ALGOL, BCPL and B by Dennis Ritchie at AT & T’s Bell Laboratories in 1972 for use on the UNIX operating system. It has since spread to many other operating systems, and is now one of the most widely used programming languages.
C is a general-purpose high level language that was originally developed by Dennis Ritchie for the Unix operating system. It was first implemented on the Digital Equipment Corporation PDP-11 computer in 1972.
http://www.ziasu.com/portfolio/portfolio/c-saw
C-saw is a mobile application for cohabitating couples to settle up their joint expenses. They don’t need to have a joint account or to split the bill every time. Just simply takes turn to pay, and C-saw will show them who should pay next time according to the difference of each person’s contribution.
● Introduction to components of a Computer System
● Introduction to Algorithm and Flowchart
● Keywords, Identifiers, Constants and Variables
● Data types in C
● Operators in C
● Basic Input and Output Operations
● Expressions and Precedence of Operators
● In-built Functions
Water billing management system project report.pdfKamal Acharya
Our project entitled “Water Billing Management System” aims is to generate Water bill with all the charges and penalty. Manual system that is employed is extremely laborious and quite inadequate. It only makes the process more difficult and hard.
The aim of our project is to develop a system that is meant to partially computerize the work performed in the Water Board like generating monthly Water bill, record of consuming unit of water, store record of the customer and previous unpaid record.
We used HTML/PHP as front end and MYSQL as back end for developing our project. HTML is primarily a visual design environment. We can create a android application by designing the form and that make up the user interface. Adding android application code to the form and the objects such as buttons and text boxes on them and adding any required support code in additional modular.
MySQL is free open source database that facilitates the effective management of the databases by connecting them to the software. It is a stable ,reliable and the powerful solution with the advanced features and advantages which are as follows: Data Security.MySQL is free open source database that facilitates the effective management of the databases by connecting them to the software.
Using recycled concrete aggregates (RCA) for pavements is crucial to achieving sustainability. Implementing RCA for new pavement can minimize carbon footprint, conserve natural resources, reduce harmful emissions, and lower life cycle costs. Compared to natural aggregate (NA), RCA pavement has fewer comprehensive studies and sustainability assessments.
Literature Review Basics and Understanding Reference Management.pptxDr Ramhari Poudyal
Three-day training on academic research focuses on analytical tools at United Technical College, supported by the University Grant Commission, Nepal. 24-26 May 2024
Hierarchical Digital Twin of a Naval Power SystemKerry Sado
A hierarchical digital twin of a Naval DC power system has been developed and experimentally verified. Similar to other state-of-the-art digital twins, this technology creates a digital replica of the physical system executed in real-time or faster, which can modify hardware controls. However, its advantage stems from distributing computational efforts by utilizing a hierarchical structure composed of lower-level digital twin blocks and a higher-level system digital twin. Each digital twin block is associated with a physical subsystem of the hardware and communicates with a singular system digital twin, which creates a system-level response. By extracting information from each level of the hierarchy, power system controls of the hardware were reconfigured autonomously. This hierarchical digital twin development offers several advantages over other digital twins, particularly in the field of naval power systems. The hierarchical structure allows for greater computational efficiency and scalability while the ability to autonomously reconfigure hardware controls offers increased flexibility and responsiveness. The hierarchical decomposition and models utilized were well aligned with the physical twin, as indicated by the maximum deviations between the developed digital twin hierarchy and the hardware.
Online aptitude test management system project report.pdfKamal Acharya
The purpose of on-line aptitude test system is to take online test in an efficient manner and no time wasting for checking the paper. The main objective of on-line aptitude test system is to efficiently evaluate the candidate thoroughly through a fully automated system that not only saves lot of time but also gives fast results. For students they give papers according to their convenience and time and there is no need of using extra thing like paper, pen etc. This can be used in educational institutions as well as in corporate world. Can be used anywhere any time as it is a web based application (user Location doesn’t matter). No restriction that examiner has to be present when the candidate takes the test.
Every time when lecturers/professors need to conduct examinations they have to sit down think about the questions and then create a whole new set of questions for each and every exam. In some cases the professor may want to give an open book online exam that is the student can take the exam any time anywhere, but the student might have to answer the questions in a limited time period. The professor may want to change the sequence of questions for every student. The problem that a student has is whenever a date for the exam is declared the student has to take it and there is no way he can take it at some other time. This project will create an interface for the examiner to create and store questions in a repository. It will also create an interface for the student to take examinations at his convenience and the questions and/or exams may be timed. Thereby creating an application which can be used by examiners and examinee’s simultaneously.
Examination System is very useful for Teachers/Professors. As in the teaching profession, you are responsible for writing question papers. In the conventional method, you write the question paper on paper, keep question papers separate from answers and all this information you have to keep in a locker to avoid unauthorized access. Using the Examination System you can create a question paper and everything will be written to a single exam file in encrypted format. You can set the General and Administrator password to avoid unauthorized access to your question paper. Every time you start the examination, the program shuffles all the questions and selects them randomly from the database, which reduces the chances of memorizing the questions.
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsVictor Morales
K8sGPT is a tool that analyzes and diagnoses Kubernetes clusters. This presentation was used to share the requirements and dependencies to deploy K8sGPT in a local environment.
Welcome to WIPAC Monthly the magazine brought to you by the LinkedIn Group Water Industry Process Automation & Control.
In this month's edition, along with this month's industry news to celebrate the 13 years since the group was created we have articles including
A case study of the used of Advanced Process Control at the Wastewater Treatment works at Lleida in Spain
A look back on an article on smart wastewater networks in order to see how the industry has measured up in the interim around the adoption of Digital Transformation in the Water Industry.
Cosmetic shop management system project report.pdfKamal Acharya
Buying new cosmetic products is difficult. It can even be scary for those who have sensitive skin and are prone to skin trouble. The information needed to alleviate this problem is on the back of each product, but it's thought to interpret those ingredient lists unless you have a background in chemistry.
Instead of buying and hoping for the best, we can use data science to help us predict which products may be good fits for us. It includes various function programs to do the above mentioned tasks.
Data file handling has been effectively used in the program.
The automated cosmetic shop management system should deal with the automation of general workflow and administration process of the shop. The main processes of the system focus on customer's request where the system is able to search the most appropriate products and deliver it to the customers. It should help the employees to quickly identify the list of cosmetic product that have reached the minimum quantity and also keep a track of expired date for each cosmetic product. It should help the employees to find the rack number in which the product is placed.It is also Faster and more efficient way.
1. Topics To Be Covered
Structure Of C Program
Identifiers
Basic Data Types And Sizes
Constants
Variables
Expressions
Operators
Input/output Statements
2. Structure of a C Program
Every C program consists of one or more modules called functions. One
of the functions must be called main. The program will always begin by
executing the main function
Each function must contain:
1. A function heading, which consists of the function name, followed
by an optional list of arguments,
1. A list of argument declarations, if arguments are included
3. A compound statement, which comprises the remainder of the
function.
• Each compound statement is enclosed within a pair of braces, { }.
• Compound statements may be nested, one within another
• Each expression statement must end with a semicolon (; )
4. The comments at the end of each line have been added in order to
emphasize the overall program organization
Normally a C program will not look like this. Rather, it might
appear as shown below.
Execution of the program results in an interactive dialog such as that
shown below. The user's response is underlined, for clarity.
Radius = 7 3
Area = 28.274309
5. IDENTIFIERS AND KEYWORDS
identifiers are names that are given to various program elements,
such as variables, functions and arrays.
Identifiers consist of letters and digits, in any order, except that the
first character must be a letter.
Both upper- and lowercase letters are permitted, though common
usage favors the use of lowercase letters for most
Types of identifiers. Upper- and lowercase letters are not
interchangeable
The underscore character ( - ) can also be included, and is
considered to be a letter.
An underscore is often used in the middle of an identifier.
An identifier may also begin with an underscore, though this is
rarely done in practice.
6. The following names are not valid identifiers ,For the reasons stated.
The following names are not valid identifiers
For the reasons stated.
7. Some Other Points About Identifiers
The identifiers file-manager and file-management are both
grammatically valid. Some compilers may be unable to distinguish
between them, however, because the first eight letters are the same for
each identifier. Therefore, only one of these identifiers should be used
in a single C program.
As a rule, an identifier should contain enough characters so that its
meaning is readily apparent.
On the other hand, an excessive number of characters should be
avoided.
A C program is being written to calculate the future value of an
investment. The identifiers value or future-value are appropriate
symbolic names. However, v or fv would probably be too brief, since
the intended representation of these identifiers is not clear. On the
other hand, the identifier future-value-of-an-investment would be
unsatisfactory because it is too long
8. Keywords
• There are certain reserved words, called keywords, that have
standard, predefined meanings in C.
• These keywords can be used only for their intended purpose;
• They cannot be used as programmer-defined identifiers.
9. • The standard keywords are
Some compilers also include some or all of the following keywords.
10. DATA TYPES
• C supports several different types of data
• Each may be represented differently within the computer’s memory
• The basic data types are listed below (Next Slide).
• Typical memory requirements are also given
• The memory requirements determine the permissible range of values
•
• Note that the memory requirements for each data type may vary
from one C compiler to another
11. C compilers written for personal computers or small minicomputers
(i.e., computers whose natural word size is less than 32 bits)
generally represent a word as 4 bytes (32 bits)
12. Points to Remember
• The basic data types can be augmented by the use of the data type
qualijiers short , long, signed and unsigned.
• Integer can be defined as short int , long int or unsigned int
• Usually written simply as short , long or unsigned
• The interpretation of integer data type will vary from one C
compiler to another
• A short int may require less or same memory than an ordinary int
but it will never exceed an ordinary int in word length.
• A long int may require the same amount of memory as an
ordinary in t or it may require more memory, but it will never be
less than an ordinary int .
• If short int and int both have the same memory requirements (e.g.,
2 bytes), then long int will generally have double the
requirements (e.g., 4 bytes)
13. Points to Remember
• If int and long int both have the same memory requirements (e.g.,
4 bytes) then short int will generally have half the memory
requirements (e.g., 2 bytes)
• An unsigned int has the same memory requirements as an ordinary
i n t . However, in the case of an ordinary int , the leftmost bit is
reserved for the sign.
• With an unsigned int , all of the bits are used to represent the
numerical value. Thus, an unsigned int can be approximately twice
as large as an ordinary int (though, of course, negative values are
not permitted).
• For example, if an ordinary int can vary from -32,768 to +32,767
(which is typical for a 2-byte int ) , then an unsigned int will be
allowed to vary from 0 to 65,535. The unsigned qualifier can also
be applied to other qualified int
14. CONSTANTS
There are four basic types of constants in C.
1. Integer constants,
2. Floating-point constants
3. Character constants
4. String constants
Integer and floating-point constants represent numbers.
They are often referred to collectively as numeric-type constants.
The following rules apply to all numeric-type constants.
Commas and blank spaces cannot be included within
The constant can be preceded by a minus (-) sign if desired
The value of a constant cannot exceed specified minimum and
maximum bounds.
15. Integer Constants
• An integer constant is an integer-valued number.
• It consists of a sequence of digits.
• Integer constants can be written in three different number systems:
decimal (base lO), octal (base 8) and hexadecimal (base 16).
• A decimal integer constant can consist of any combination of
digits taken from the set 0 through 9.
• If the constant contains two or more digits, the first digit must be
something other than 0.
16.
17. Octal Integer Constant
An octal integer constant can consist of any combination of
digits taken from the set 0 through 7. However the first digit
must be 0,in order to identify the constant as an octal number.
18. Hexadecimal Integer Constant
A hexadecimal integer constant must begin with either Ox or OX. It
can then be followed by any combination of digits taken from the sets
0 through 9 and a through f (either upper- or lowercase). Note that
the letters a through f (or A through F) represent the (decimal)
quantities 10 through 15, respectively.
19. Unsigned and Long Integer Constants
Unsigned integer constants may exceed the magnitude of ordinary
integer constants by approximately a factor of 2, though they may
not be negative.* An unsigned integer constant can be identified by
appending the letter U (either upper- or lowercase) to the end of the
constant.
Long integer constants may exceed the magnitude of ordinary
integer constants, to create a long integer constant by appending the
letter L (either upper- or lowercase) to the end of the constant. An
unsigned long integer may be specified by appending the letters UL
to the end of the constant. The letters may be written in either upper-
or lowercase. However, the U must precede the L.
22. Character Constants
A character constant is a single character, enclosed in apostrophes (i.e.,
single quotation marks). Several character constants are shown below.
Escape Sequences
Certain nonprinting characters, as well as the backslash () and the
apostrophe (‘’ ), can be expressed in terms of escape sequences.
An escape sequence always begins with a backward slash and is
followed by one or more special characters.
24. String Constants
A string constant consists of any number of consecutive characters
(including none), enclosed in double quotation marks.
Several string constants are shown below.
Note that the string constant "Line 1n Line 2n Line 3" extends over
three lines, because of the newline characters that are embedded
within the string. Thus, this string would be displayed as
Line 1
Line 2
Line 3
Also, notice that the string “ ” is a null (empty) string
25. EXPRESSIONS
• An expression represents a single data item, such as a number or a
character.
• The expression may consist of a single entity, such as a constant, a
variable, an array element or a reference to a function.
• It may also consist of some combination of such entities,
interconnected by one or more operators.
• Expressions can also represent logical conditions that are either
true or false.
• In C the conditions true and false are represented by the integer
values 1 and 0,respectively
29. OPERATORS
Arithmetic Operators
There are five arithmetic operators in C. They are
The % operator is sometimes referred to as the modulus operator.
There is no exponentiation operator in C.
There is a library finction (POW) to carry out Exponentiation.
30. Points to Remember
• The operands acted upon by arithmetic operators must represent
numeric values
• Operands can be integer quantities, floating-point quantities
• The remainder operator (%) requires that both operands be
integers and the second operand be nonzero.
• Division operator (/) requires that the second operand be
nonzero.
• Division of one integer quantity by another is referred to as
integer division.
• This operation always results in a truncated quotient (i.e., the
decimal portion of the quotient will be dropped).
• If a division operation is carried out with two floating-point
numbers, or with one floating-point number and one integer, the
result will be a floating-point quotient.
31. Suppose that a and b are integer variables whose values are 10 and
3, respectively. Several arithmetic expressions involving these
variables are shown below, together with their resulting values.
32. Now suppose that vl and v2 are floating-point variables whose
values are 12.5 and 2.0, respectively. Several arithmetic
expressions involving these variables are shown below, together
with their resulting values.
33. Suppose that a and b are integer variables whose values are 11 and
-3, respectively. Several arithmetic expressions involving these
variables are shown below, together with their resulting values.
34. Let rl and r2 be floating-point variables whose assigned values
are -0.66 and 4.50. Several arithmetic expressions involving these
variables are shown below, together with their resulting values.
35. Unary Operators
C includes a class of operators that act upon a single operand to
produce a new value. Such operators are known as unary
operators.
Unary operators usually precede their single operands, though
some unary operators are written after their operands.
Perhaps the most common unary operation is unary minus,
where a numerical constant, variable or expression is preceded
by a minus sign.
37. Suppose that i, j and k are integer variables whose values are 1, 2 and
3, respectively. Several logical expressions involving these variables
are shown below
logical operators / logical connectives
38. Assignment Operators
There are several different assignment operators in C.
Used to form assignment expressions
Assign the value of an expression to an identifier
The most commonly used assignment operator is =
identifier = expression
where identifier generally represents a variable
expression represents a constant
39. Some typical assignment expressions that make use of the =
operator
In the following assignment expressions, suppose that i is an
integer-type variable.
40. Now suppose that i and j are both integer-type variables, and that j
has been assigned a value of 5. Several assignment expressions that
make use of these two variables are shown below.
41. Multiple assignments
Assignments Are Carried Out From Right To Left
Above assignment equivalent to
Suppose that i and j are integer variables. The multiple
assignment expression will cause the integer value 5 to be
assigned to both i and j . (To be more precise, 5 is first assigned
to j , and the value of j is then assigned to i.) Similarly, the
multiple assignment expression i = j = 5.9 ,will cause the integer
value 5 to be assigned to both i and j .
42. Additional Assignment Operators
The assignment expression
is equivalent to
The assignment expression
is equivalent to
expression 1 is an identifier, such as a variable or an array element
43. Suppose that i and j are integer variables whose values are 5 and 7,
and f and g are floating-point variables whose values are 5.5 and -
3.25. Several assignment expressions that make use of these
variables are shown below. Each expression utilizes the original
values of i, j , f and g
44. The Conditional operator
Simple conditional operations can be carried out with the
conditional operator (? :).
An expression that makes use of the conditional operator is
called a conditional expression.
A conditional expression is written in the form
When evaluating a conditional expression, expression 1 is evaluated
first. If expression 1 is true (i.e., if its value is nonzero), then
expression 2 is evaluated and this becomes the value of the
conditional expression. However, if expression 1 is false (i.e., if its
value is zero), then expression 3 is evaluated and this becomes the
value of the conditional expression.
45. In the conditional expression shown below, assume that i is an
integer variable.
The expression (i < 0) is evaluated first. If it is true, the entire
conditional expression takes on the value 0. Otherwise ,the entire
conditional expression takes on the value 100.
In the following conditional expression, assume that f and g are
floating-point variables.
This conditional expression takes on the value off f if it is less than
g; otherwise, the conditional expression takes on the value of g. In
other words, the conditional expression returns the value of the
smaller of the two variables.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55. Input/output Statements
The Functions permits the transfer of information between the
computer and the standard input/output devices e.g., a keyboard
and a TV monitor
These six are as follows:
1. getchar
2. putchar
3. scanf
4. printf
5. gets
6. Puts
The header file required by the standard input/output library
functions is called stdio .h
56. 1. SINGLE CHARACTER INPUT -THE getchar FUNCTION
getchar function is a part of the standard C I/O library
It returns a single character from a standard input device
(typically a keyboard)
The function does not require any arguments, though a pair of
empty parentheses must follow the word getchar
In general terms, a function reference would be written as
character variable = getchar ( ) ;
where character variable refers to some previously declared
character variable.
57. A C program contains the following statements
char c;
. . . . .
c = getchar();
The first statement declares that c is a character-type variable
The second statement causes a single character to be entered
from the standard input device (usually a keyboard)
Then assigned to c
58. SINGLE CHARACTER OUTPUT -THE putchar FUNCTION
Single characters can be displayed i.e., written out of the computer
using the C library function putchar
It is complementary to the character input function getchar
It is a part of the standard C I/O library
It transmits a single character to a standard output device (typically a
TV monitor)
It must be expressed as an argument to the function, enclosed in
parentheses, following the word putchar
In general, a function reference would be written as
putchar ( character variable)
where character variable refers to some previously declared
character variable
59. A C program contains the following statements
char c;
. . . . .
putchar(c);
The first statement declares that c is a character-type variable
The second statement causes the current value of c to be
transmitted to the standard output device (e.g., a TV monitor)
where it will be displayed.
61. ENTERING INPUT DATA -THE scanf FUNCTION
This function can be used to enter any combination of
numerical values ,single characters and strings.
The function returns the number of data items
that have been entered successfully
where control string refers to a string containing certain required
formatting information
arg1, arg2, . . . argn are arguments that represent the individual
input data items
The control string consists of individual groups of characters, with
one character group for each input data item
a single character group will consist of the percent sign, followed
by a conversion character which indicates the type of the
corresponding data item
63. The arguments are written as variables or arrays, whose types
match the corresponding character groups in the control string
Each variable name must be preceded by an ampersand (a). (The
arguments are actually pointers that indicate where the data items
are stored in the computer's memory
Here is a typical application of a scanf function.
64. WRITING OUTPUT DATA -THE printf FUNCTION
Output data can be written from the computer onto a standard
output device using the library function printf
This function can be used to output any combination of numerical
values, single characters and strings
In general terms, the printf function is written as
65. where control string refers to a string that contains formatting
information,
and arg7, arg2, . . . , argn are arguments that represent the individual
output data items.
The arguments can be written as constants, single variable or array
names, or more complex expressions.
Function references may also be included.
In a printf function do not represent memory addresses and therefore
are not preceded by ampersands.
The control string consists of individual groups of characters, with
one character group for each output data item.
Each character group must begin with a percent sign (%). In its
simplest form,
An individual character group will consist of the percent sign,
followed by a conversion character indicating the type of the
corresponding data item.
67. Here is a simple program that makes use of the printf function.
Notice that the first two arguments within the printf function are
single variables, the third argument is an arithmetic expression,
and the last argument is a function reference that has a numeric
expression as an argument. Executing the program produces the
following output:
2.000000 3.000000 5.000000 2.236068
68. The following skeletal outline indicates how several different
types of data can be displayed using the printf function
Within the printf function, the control string is "%s %d %f It
contains three character groups. The first character group, %s,
indicates that the first argument (item) represents a string. The
second character group, %indicates that the second argument (part
no) represents a decimal integer value, and the third character group,
%indicates that the third argument (cost) represents a floating-point
value.