








































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
This lecture was delivered by Prof. Varun Sahil to explain Programming concepts at Ankit Institute of Technology and Science. It includes: Traditionally, Programs, Extension, Languages, Microsoft, Compiler, Visual, Studio, Jargon, Executable
Typology: Slides
1 / 48
This page cannot be seen from the preview
Don't miss anything!









































^ Traditionally C programs use the fileextension .C and C++ programs theextension .CPP ^ C is essentially a subset of C++, so youcould use a C++ compiler to run a Cprogram. The two languages areextremely similar. ^ In the labs we will be using a
Microsoft
compiler called Microsoft Visual Studio.
C Program:^ #include <stdio.h>int main(){ printf(“Hello World!”);return 0;}
Example: Hello World
Basic Structure of a C Program
#include
<stdio.h> int^ main(){ printf(“Hello
World!”); return
0; C Program }
:
Example: Hello world Includes standardinput/output library ofprocedures. Read: “Hash-include”
C Program:^ #include <stdio.h>int main(){ printf(“Hello World”);return 0;}
Curly braces mark the beginning
and^ end
of a
Example: block of instructions.
Hello World
C Program:^ #include <stdio.h>int main(){ printf(“Hello World”);return 0;}
Instruction (
function call
)
Example: to output “Hello World”
Hello World
^ Writes on screen text in quotes ^ Quotes around string ^ Enclosed in parenthesis ^ Ends in semicolon
^ \n – new line ^ \t - horizontal tab ^ \r - carriage return ^ \a - sound bell
^ printf is a library function printf("SS-CARE \n School
of \n Engineering");
SS-CARESchool
of Engineering
^ Variables, can be declared anywhere in theprogram. ^ However they are only visible to the programwithin the block of code in which they aredefined.
int^ main()
{ int^ x^
=^ 4; if^ (x>3){
int^ y^
=^ 3; } return
(0) }
^ Basic Types:^ ^ Integers (signed and unsigned)
^ short ^ int Floating point numbers ^ float ^ double Characters (signed and unsigned) Boolean
^ Characters (
char
’a’ ’z’ ’A’ ’Z’ ’?’ ’@’ ’0’ ’9’
^ Name & type must be declared beforeuse ^ Allows for error checking ^ Explicit declaration