


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
This PDF explains the basics of C programming, focusing on preprocessor directives, library functions, and input/output operations using printf() and scanf(). Ideal for beginners to understand core concepts quickly.
Typology: Schemes and Mind Maps
1 / 4
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: