


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



AIM: To learn about the C Library, Preprocessor directive, Input- output statement. SOFTWARE REQUIRED: Turbo C/C++ THEORY: โ C Libraries: A library in C consists of pre- defined functions, constant keywords and header files like <stdio.h>, <conio.h>, <string.h>, <stdlib.h>, etc. A library in C is a group of functions and declarations, exposed for use by other programs. a) <stdio.h>: Defines core input and output functions like printf( ), scanf( ). b) <conio.h>: Contains functions for Console input/output functions like clrscr( ), getch( ) c) <string.h>: Defines string handling functions like strrev( ), strlen( ), strcpy(), strcmp( ), strcat( ). โ Preprocessor Directives: Preprocessor programs provide preprocessors directives which tell the compiler to preprocess the source code before compiling. All of these preprocessor directives begin with a โ#โ (hash) symbol. This (โ#โ) symbol at the beginning of a statement in a C/C++ program indicates that it is a pre-processor directive. We can place these preprocessor directives anywhere in our program. Examples of some preprocessor directives are: #include , #define , #ifndef etc. โ Input- Output Statements: Input means to provide the program with some data to be used in the program and Output means to display data on screen or write the data to a printer or a file. C programming language provides many built-in functions to read any given input and to display data on screen when there is a need to output the result. There are two types of input- output functions:
#include<stdio.h> #include<conio.h> void main( ) { int a, b; printf( โEnter two numbers:); scanf(โ%d %dโ,&a,&b); int c; c=a+b; printf(โAdded result = %dโ,c); getch( ); } OUTPUT OF THE CODE: