
Introduction to C Programming
Explore the history, tokens, constants, data types, variables, keywords, and operators in the C programming language. Learn about its simplicity, reliability, and strong foundation. Buy books online for more learning resources.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Visit for more Learning Resources Visit for more Learning Resources
Introduction Introduction to to C C C is a programming language. It is strong, simple and reliable. Buy book Online - www.icebreakerspublications.com
H Hiis st tory ory O Of f C C C programming was written by Dennis Ritchie in 1972. It was developed at AT & T s Bell Laboratories in USA. Buy book Online - www.icebreakerspublications.com
C C Tokens Tokens Buy book Online - www.icebreakerspublications.com
C C Constants Constants int m = 56; Here, 56 is Constant and m is Variable. Types of Constants: 1) Primary Constants 2) Secondary Constants Type Example Integer Constants +226 , -946 RealConstants +123.23, -22.34 CharacterConstants G , 5 , + Buy book Online - www.icebreakerspublications.com
C C Data DataTypes Types int a = 2 ; Datatype Variable Constant Types of data types: 1. Primary Data Type 2. Secondary Data Type Primary Data Type Secondary Data Type : arrays, pointer, structures, union, enum. : character, integer, float, double, void Buy book Online - www.icebreakerspublications.com
V Va ariabl riable es s int a = 2 ; Datatype Variable Constant Definition of Variable: Variables in C are memory locations that are given names. Variables are the entities which can change at different times we use variables to store data in memory. As shown in figure, a is variable. Buy book Online - www.icebreakerspublications.com
C C Keywords Keywords Keywords are the words whose meaning has already been explained to the C compiler. The following names are reserved by the C language. Their meaning is already defined, and they cannot be re-defined. Buy book Online - www.icebreakerspublications.com
Operators Operators Definition: Operators are the Symbols used to indicate the operations on the operands. e.g. 10+20 ------- 10 & 20 are operands and + is an operator Type of Operators 1)Arithmetic 2)Relational 3)Logical 4)Assignment 5)Conditional 6)Bitwise 7)Special 8)Increment / Decrement Buy book Online - www.icebreakerspublications.com
Pre Pre- -processor processor Directive Directive Pre-processor directive is #define. #define MAX 10 #define is generally used to define constantvalues It is generally written in upper case like MAX It never terminateswith semicolon Buy book Online - www.icebreakerspublications.com
Main Main Function Function Syntax: void main() { ---- ---- Declarative Or Executable Statements ---- } void main(): Used to start of actual C program. It includes two parts as declarative Statements and executable Statements. Buy book Online - www.icebreakerspublications.com
Basic Structure Basic Structure Of Of C C Program Program Document Section Links Section (File) DefinitionSection Global variable declarationSection voidmain() { Variable declaration section Function declaration section executablestatements; } Functiondefinition1 Functiondefinition2 --------------------- --------------------- (User DefinedFunctions) --------------------- Functiondefinitionn Buy book Online - www.icebreakerspublications.com
My My First C First C Program Program #include <stdio.h> intmain() { /* my first program in C */ printf("Hello, World! \n"); return0; } Buy book Online - www.icebreakerspublications.com
Pr Priintf ntf Printf : It is a function used for displaying a value or a data on the screen. Syntax : printf ( format string , variable1, variable2 ) ; Meaning Example Result Format String %d 5 int num=5; Prints a printf( %d",num); Decimal Integer %c R char ch= r ; Prints asingle printf( %c ,ch); character %f Prints afloat float num=14.44; 14.44 value printf( %f ,num); %s Printsa char str[]="icebreakers ; Icebreakers String printf( %s ,str); Buy book Online - www.icebreakerspublications.com
Sc Sca an nf f Printf : It is a function used for accepting a value or a data from keyboard. scanf ( format string , &variable1, &variable2 ) ; Syntax : Meaning Example Result Format String %d scanf( %d",&num); Reads a %d accepts the digit number from user andit Decimal will get stored in num variable. Integer %c scanf( %c ,&ch); Reads a %c accepts the character from user and itwill single get stored in ch variable. character %f scanf( %f ,&num); Reads a float %f accepts the float number from user andit value will get stored in numvariable. %s scanf( %s ,str); Readsa %s accepts the string from user and it willget ( & is notrequired) String stored in str variable.
Solved Solved Programs Programs Program 1 : First Program in C to wish Hello World to user. #include<stdio.h> #include<conio.h> intmain() { clrscr(); charname[10]; //including the header file //including the header file //Clear the output screen //variabledeclaration Output: printf ( Enter Name:: ); Scanf( %s ,name); //Displaying the message //Accepting the data Enter Name::icebreakers Hello icebreakers printf( \nHello%s ,name); getch(); screen return0; } //function for quick output Buy book Online - www.icebreakerspublications.com
Solved Solved Programs Programs Program 2 : c program to print integer #include<stdio.h> #include<conio.h> intmain() { clrscr(); Int a; //including the header file //including the header file //Clear the output screen //variabledeclaration Output: Enter an integer 45 printf("Enter an integer\n"); Scanf( %d ,&a); //Displaying the message //Accepting the data Integer the you have entered is 45 printf("Integer that you have entered is %d\n", a); getch(); screen return0; } //function for quick output For more detail contact us Buy book Online - www.icebreakerspublications.com For more detail contact us