Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

C programming experiment, Schemes and Mind Maps of C programming

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

2023/2024

Available from 04/27/2025

tu-fg-gg
tu-fg-gg 🇮🇳

1 document

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
PROGRAM-1
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:
1. Formatted Input- Output Functions: printf( ), scanf( ).
2. Non- Formatted Input- Output Functions: getche( ), getch( ), putch( ),
putche( ), etc.
pf3
pf4

Partial preview of the text

Download C programming experiment and more Schemes and Mind Maps C programming in PDF only on Docsity!

PROGRAM-

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:

  1. Formatted Input- Output Functions : printf( ), scanf( ).
  2. Non- Formatted Input- Output Functions: getche( ), getch( ), putch( ), putche( ), etc.

CODE:

#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: