Thursday, 30 June 2016
Wednesday, 29 June 2016
Output Functions in C-Programming
The C language provides a set of library functions to perform input and output (I/O) operations. Those functions can read or write any type of data to files.
Here printf(),scanf() functions are included in #include<stdio.h>
Printf() ----> to print the Information.
Scanf() ----> to read the Values.
Printf() ----> to print the Information.
Scanf() ----> to read the Values.
Here clrscr(), getch() functions are included in #include<conio.h>
Clrscr(); ----> to clear the previous output’s
Getch(); ----> to get the information or values
Computer displaying result is called output.
If we want to display the information on standard Output device we can use printf().
Printf( ):-
It is standard Output function which is used to display the information given by the user.
Syntax:
They are 3 types of syntax's.
Syntax 1:
printf(" information");To print information.
Ex:-
printf("Computersadda");
Sample Program:-
#include<stdio.h> #include<conio.h> void main() { clrscr(); printf("welcome to C-language"); getch(); } |
Output:-
welcome to C-language |
Sample Program 2:-
#include<stdio.h> #include<conio.h> void main( ) { clrscr( ); printf("One"); printf("Two"); printf("Three"); getch( ); } |
Output:-
OneTwoThree |
Syntax 2 :
To print 1 value.
Ex:-
printf("%d", a);
printf(" control strings ",variablename1,--- variablename n);
To print more than 1 value.
Syntax 3:
To print more than 1 value.
Ex:-
printf("%d%d",a,b);
__________________________________________________________________________________
__________________________________________________________________________________
Tuesday, 28 June 2016
Editors of C-Programming
Editors
|
|||
Action
|
Turbo C
|
Turbo C++
|
C-Free
|
Programs
|
Only ‘C’ Programs
|
‘C’ & ‘C++’ Programs
|
‘C’ & ‘C++’ Programs
|
Space
|
More Space occupy
|
More Space occupy
|
Small Space occupy
|
Support
|
It Support all
Header files
|
It Support all
Header files
|
Not Support Some Header files
(Conio.h)
|
Save
|
F2
|
F2
|
Ctrl + S
|
Compile
|
Alt + F9
|
Alt + F9
|
F5
|
Execute
(or)
Run
|
Ctrl + F9
|
Ctrl + F9
|
F5
|
__________________________________________________________________________________
__________________________________________________________________________________
Monday, 27 June 2016
Escape Sequences
These are non-printable characters.
Escape sequences
|
|
Character
|
Meaning
|
\n
|
New
line
|
\t
|
Horizontal
tab
|
\'
|
Single
quote
|
\"
|
Prints
double quotes
|
\\
|
Back
slash
|
\f
|
Form
feed
|
\r
|
Carriage
return
|
\a
|
Audible
alert
|
\b
|
Backspace
|
\v
|
Vertical
tab
|
\?
|
Question
mark
|
\0 (Zero)
|
Null
character
|
%%
|
percentage
|
__________________________________________________________________________________
__________________________________________________________________________________
Control String (Conversion Characters)
Control String:-
It’s used to compare the individual char’s with one character group for each output data item, each character must be % sign fallowing conversion character in indicating the type of data.
These are individual output data items arguments can be written as variables/expressions.
CONVERSION CHARACTERS
|
|
Character
|
Meaning
|
%c
|
Single
character
|
%d
|
Decimal
integer
|
%f
|
Float
value without exponential
|
%e
|
Float
value in exponent form
|
%g
|
Float
type depending on value
|
%i
|
Signed
decimal integer
|
%o
|
An
octal integer without leading zero
|
%s
|
String
|
%u
|
Unsigned
decimal integers
|
%x
|
Hexadecimal
integer without leading ox
|
%hd
|
Short
integer
|
%lu
|
Long
unsigned int
|
%ld
|
Long
integer
|
%lf
|
Double
|
%lf
|
Long
double
|
__________________________________________________________________________________
__________________________________________________________________________________
Sunday, 26 June 2016
Simple Structure of C-Programming
#include<header file>
main()
{
Variable declaration part
Executable statement part
}
Note:-
1. Blank spaces may be inserted between two words.
2. No blank spaces are allowed with in a word.
3. Usually all ‘c’ statements are entered in small case letters.
4. ‘C’ has no specific rules about the position at which different parts of a program.
5. Every program must have a special function named main ( ).
6. Every statement is terminated by semicolon.
__________________________________________________________________________________
__________________________________________________________________________________
Executing a C Programming
Executing a ‘C’ program:-
Executing a program written in ‘C’ involves series of steps.
They are
1. Creating a program
2. Compiling a program
3. Linking the program with functions that are needed from ‘C’ library.
4. Executing the program
Creating a program:-
The program must be entered into a file. The file name can consists of letters, digits and special char’s fallowed by a. “.” & a letter c or cpp. The file is creating with the help of ‘C’. editor.
Compiling a program:-
The same program instruction is now translated into a form that is suitable for execution by the computer. The translation is done after examing each instruction for its corrections. It every thing is all right, the compilation proceeds silently and the translated program is stored on another file with the name “file name.obj”.
Linking and execution:-
Linking is the process of putting together other program files and functions that are required by the program.
For example:-
It the program is using squrt( ), then the object code of this function should be brought from the math library of the system & linked to main program & it stored automatically in another file named “ filename.exe”.
__________________________________________________________________________________
__________________________________________________________________________________
Subscribe to:
Posts
(
Atom
)