Professional Documents
Culture Documents
Programming in C Variables Data Types Input Output 073314
Programming in C Variables Data Types Input Output 073314
Programming in C Variables Data Types Input Output 073314
• C Language
• VARIABLES
For example:
Hello.c>
1. #include<stdio.h>
4.
5. int number = 25 ; (int shows variable is integer; number shows variable and 25 is
a data)
9. return 0
Here;
( ) is parenthesis
{ is curly braise
int is used data type for integer values.
• RULES OF VARIABLES
• CONSTANTS
A constant is a value or variable that can't be changed in the program, for example: 10,
20, 'a', 3.4, "c programming" etc.
• KEYWORDS
1. Reserved words that have special meaning to compiler are called keywords
3. Certain words reserved cannot be used as variable; these words are keywords.
• COMMENTS
Lines that are not part of program and can be used to explain code, and to make it more
readable are called comments in C. It can also be used to prevent execution when testing
alternative code.
Output means to supersede some data on screen printer or any while file. A function is
specific type of relation in which each input value has one and only one output value. An
1. “printf” is the name of one of the main see output functions and stands for print
formatted.
2. There format strings are complementary to scanf format strings which provide
formatted input.
3. printf and scanf are built library functions in C language that perform formatted Input
and formatted output functions.
4. scanf reads data from the standard input stream STD in to the locations given by each
entry in argument list. Each argument list must have a pointer to a variable with a
type that the response to a types specifier in format string.
1. Integers
2. Real Numbers
a. printf("value of pi is %f",pi);
3. Characters
CASES OF INPUT
1. scanf(”%d”,&age);
d. %d is a format specifier
For example:
1. #include <stdio.h>
2.
3. int main ( ) {
4. int age;
5. printf("enter age”);
6. scanf(”&d",&age);
8. return 0
9. }
enter age 22
age is : 22
RECAP POINTS:
1. A line containing only white space possibly with a comment is known as blank line and
a C compiler totally ignores it.
2. There are data types in C that refer to an extensive system used for declaring variables
are functions of different types and day determine how much space it occupies in storage
and how the bit pattern is stored is integrated.
a. Basic types
i. Integer types
b. Enumerated types
i. There are again arithmetic types and they are used to define variables that can
only assign certain discrete integer values throughout the program.
c. Type void
d. Derived types
i. Pointer types
v. Function types
4. The array types and structure types are referred collectively as the aggregate types.
5. Variable is nothing but a name given to a Storage area that our programs can manipulate.
Each variable in C has a specific type which determines the size and layout of the
variables memory and the ranges of the values that can be stored within the memory and
also the set of operations that can be performed or applied to the variable.
6. char
7. int
8. float
9. double
10. void
11. Variables tell the compiler where and how much storage to create for the variable and the