The document is a lecture on C programming given on August 17th, 2008 at IIT Kanpur by Deepak Majeti. It covers basics of C including data types, operators, input/output functions, and provides examples of simple C programs. It also discusses compilation, debugging errors, and homework problems involving operator precedence.
Presentation on C++ Programming Languagesatvirsandhu9
It consists information about c++ programming language which is a object oriented language. This presentation is very useful for those who want to learn c++ from beginning.
C and C ++ Training in Ambala ! BATRA COMPUTER CENTREjatin batra
Batra Computer Centre is An ISO certified 9001:2008 training Centre in Ambala.
We Provide Best C and C ++ Training in Ambala. BATRA COMPUTER CENTRE provides best training in C, C++, S.E.O, Web Designing, Web Development and So many other courses are available.
This is an overview of C++ (based on 1999 / 2003 standard) and its use in Object Oriented Programming. The presentation assumes that the audience knows C programming.
Presentation on C++ Programming Languagesatvirsandhu9
It consists information about c++ programming language which is a object oriented language. This presentation is very useful for those who want to learn c++ from beginning.
C and C ++ Training in Ambala ! BATRA COMPUTER CENTREjatin batra
Batra Computer Centre is An ISO certified 9001:2008 training Centre in Ambala.
We Provide Best C and C ++ Training in Ambala. BATRA COMPUTER CENTRE provides best training in C, C++, S.E.O, Web Designing, Web Development and So many other courses are available.
This is an overview of C++ (based on 1999 / 2003 standard) and its use in Object Oriented Programming. The presentation assumes that the audience knows C programming.
Programming is hard. Programming correct C and C++ is particularly hard. Indeed, both in C and certainly in C++, it is uncommon to see a screenful containing only well defined and conforming code.Why do professional programmers write code like this? Because most programmers do not have a deep understanding of the language they are using.While they sometimes know that certain things are undefined or unspecified, they often do not know why it is so. In these slides we will study small code snippets in C and C++, and use them to discuss the fundamental building blocks, limitations and underlying design philosophies of these wonderful but dangerous programming languages.
This content has a CC license. Feel free to use it for whatever you want. You may download the original PDF file from: http://www.pvv.org/~oma/DeepC_slides_oct2012.pdf
This presentation comes with many additional notes (pdf): http://de.slideshare.net/nicolayludwig/2-c-sharp-introductionbasicsparti-38639098
- A Tour through other .Net Programming Languages
- C# Syntax Cornerstones
An introduction to the C programming language for the students of the course "HJ-82 Ontwerpen voor de optie multimedia en signaalverwerking: seminaries", taught by the authors at the Catholic University of Leuven.
This is Work-In-Progress. Developing a series of lectures on C++0x. This will augment my presentations on C++ and Design Pattern. First trial run was done at Interra, Noida in 2009
Object Oriented Programming With Real-World ScenarioDurgesh Singh
We write programs to solve our problem and get our work done. Object Oriented Programming is basically considered as design methodology for creating a non-rigid application. In OOPS every logic is written to get our work done, but this is done based on entity which we call it as Objects. OOP allow us to decompose our problem in to small unit of work which are accessed via Objects. We build function around this objects. There are mainly four pillars (features) of OOP.
C Programming Language Tutorial for beginners - JavaTpointJavaTpoint.Com
JavaTpoint share a presentation of C Programming language for beginners and professionals. now in this slideshare you will be learned basics of c programming language, what is c programming language, history of c programming, installing turbo c, features of c programming language, datatypes of c language, operaters in c, control statement of c language, c language functions, c array, pointer in c programming, and structure and union.
Programming is hard. Programming correct C and C++ is particularly hard. Indeed, both in C and certainly in C++, it is uncommon to see a screenful containing only well defined and conforming code.Why do professional programmers write code like this? Because most programmers do not have a deep understanding of the language they are using.While they sometimes know that certain things are undefined or unspecified, they often do not know why it is so. In these slides we will study small code snippets in C and C++, and use them to discuss the fundamental building blocks, limitations and underlying design philosophies of these wonderful but dangerous programming languages.
This content has a CC license. Feel free to use it for whatever you want. You may download the original PDF file from: http://www.pvv.org/~oma/DeepC_slides_oct2012.pdf
This presentation comes with many additional notes (pdf): http://de.slideshare.net/nicolayludwig/2-c-sharp-introductionbasicsparti-38639098
- A Tour through other .Net Programming Languages
- C# Syntax Cornerstones
An introduction to the C programming language for the students of the course "HJ-82 Ontwerpen voor de optie multimedia en signaalverwerking: seminaries", taught by the authors at the Catholic University of Leuven.
This is Work-In-Progress. Developing a series of lectures on C++0x. This will augment my presentations on C++ and Design Pattern. First trial run was done at Interra, Noida in 2009
Object Oriented Programming With Real-World ScenarioDurgesh Singh
We write programs to solve our problem and get our work done. Object Oriented Programming is basically considered as design methodology for creating a non-rigid application. In OOPS every logic is written to get our work done, but this is done based on entity which we call it as Objects. OOP allow us to decompose our problem in to small unit of work which are accessed via Objects. We build function around this objects. There are mainly four pillars (features) of OOP.
C Programming Language Tutorial for beginners - JavaTpointJavaTpoint.Com
JavaTpoint share a presentation of C Programming language for beginners and professionals. now in this slideshare you will be learned basics of c programming language, what is c programming language, history of c programming, installing turbo c, features of c programming language, datatypes of c language, operaters in c, control statement of c language, c language functions, c array, pointer in c programming, and structure and union.
structure of c program. everything about the structure is in this ppt...................................................................viearhgviuehdrgbvkejfsdbvaerhbgf;oiweHFGIO;WENEGV;KLADFN;OVIBNA;OINVO;IRANV;OINDF;LNVOIASRDNGVIOERNAVB EOANGVV ERNGOEWN
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docxrafbolet0
Spring 2014 CSCI 111 Final exam � of �1 6
1. (2 points) Flip over this test. On the back of this test write your name in the upper, left-hand
corner.
2. (2 points) What are the four parts of the compiling process (just give me 4 words, not a
paragraph).
3. (4 points) Which of the four steps of the compiling process occurs only once, regardless of
the number of source files your application has?
4. (4 points) Write a line of code that causes the preprocessor to generate an error.
5. (4 points) Write a line of code that causes the compiler to generate an error.
6. (5 points) Describe how you could incorrectly compile the joust project to cause the linker to
generate an error.
7. (5 points) Given:
1 float* fp;
2 //...
3 float pi;
4 pi=*(314 + fp);
Rewrite line 4 using array subscript notation.
Spring 2014 CSCI 111 Final exam � of �2 6
8. (5 points) Given:
1 float arr[100];
2 for(int x=0; x<100; ++x)
3 arr[x]=100-x;
What does the following expression print out?
cout << *arr << endl;
9. (14 points) Given:
int a=0;
int b=6;
int x=0;
Circle each if-expression that evaluates to true:
A) if(b)
B) if(x)
C) if(a=b==6)
D) if(a=b==5)
E) if(a=b=5)
F) if(a=x=0)
G) if(a=x==0)
Spring 2014 CSCI 111 Final exam � of �3 6
10. (10 points) Given:
1 #include<iostream>
2 using namespace std;
3
4 int main()
5 {
6 int x;
7 cout << "Enter a number greater than 10" << endl;
8 while ( x < 10 )
9 {
10 cin >> x;
11 }
12 return 0;
13 }
This program compiles just fine, and sometimes it runs as expected. But sometimes when you
run it, it exits immediately after printing "Enter a number greater than 10". That is, the program
doesn't pause for you to enter a number. Why are you getting this inconsistent behavior?
11. (4 points) What is the output of the following:
int x=4;
int y=3;
A) cout << x / y << endl;
B) cout << x % y << endl;
C) cout << x << "%" << y << endl;
D) cout << "x" << '%' << 'y' << endl;
Spring 2014 CSCI 111 Final exam � of �4 6
12. (16 points) What is the type of the expression. That is, what is the kind of thing that each
expression evaluates to. For example:
3 + 4 integer
You may assume that the variable a has been declared as an integer.
A. a + 4
B. a = 4
C. 3.14 + 4.49
D. 3 + 3.14
E. 'a'
F. cout << a
G. new float[30]
H. new float
Spring 2014 CSCI 111 Final exam � of �5 6
13. (5 points) Write a for-loop that prints out the numbers between 1 and 100 that are evenly
divisible by three.
14. (5 points) Write a while-loop that prints out the numbers between 1 and 100 that are evenly
divisible by three.
15. (5 points) Write a do-while-loop that prints out the numbers between 1 and 100 that are
evenly divisible by three.
Spring 2014 CSCI 111 Final exam � of �6 6
16. (10 points) Given:
1 #include<iostream>
2
3 class Willow {
4 publi.
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)MdTanvirMahtab2
This presentation is about the working procedure of Shahjalal Fertilizer Company Limited (SFCL). A Govt. owned Company of Bangladesh Chemical Industries Corporation under Ministry of Industries.
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
Welcome to WIPAC Monthly the magazine brought to you by the LinkedIn Group Water Industry Process Automation & Control.
In this month's edition, along with this month's industry news to celebrate the 13 years since the group was created we have articles including
A case study of the used of Advanced Process Control at the Wastewater Treatment works at Lleida in Spain
A look back on an article on smart wastewater networks in order to see how the industry has measured up in the interim around the adoption of Digital Transformation in the Water Industry.
Explore the innovative world of trenchless pipe repair with our comprehensive guide, "The Benefits and Techniques of Trenchless Pipe Repair." This document delves into the modern methods of repairing underground pipes without the need for extensive excavation, highlighting the numerous advantages and the latest techniques used in the industry.
Learn about the cost savings, reduced environmental impact, and minimal disruption associated with trenchless technology. Discover detailed explanations of popular techniques such as pipe bursting, cured-in-place pipe (CIPP) lining, and directional drilling. Understand how these methods can be applied to various types of infrastructure, from residential plumbing to large-scale municipal systems.
Ideal for homeowners, contractors, engineers, and anyone interested in modern plumbing solutions, this guide provides valuable insights into why trenchless pipe repair is becoming the preferred choice for pipe rehabilitation. Stay informed about the latest advancements and best practices in the field.
Immunizing Image Classifiers Against Localized Adversary Attacksgerogepatton
This paper addresses the vulnerability of deep learning models, particularly convolutional neural networks
(CNN)s, to adversarial attacks and presents a proactive training technique designed to counter them. We
introduce a novel volumization algorithm, which transforms 2D images into 3D volumetric representations.
When combined with 3D convolution and deep curriculum learning optimization (CLO), itsignificantly improves
the immunity of models against localized universal attacks by up to 40%. We evaluate our proposed approach
using contemporary CNN architectures and the modified Canadian Institute for Advanced Research (CIFAR-10
and CIFAR-100) and ImageNet Large Scale Visual Recognition Challenge (ILSVRC12) datasets, showcasing
accuracy improvements over previous techniques. The results indicate that the combination of the volumetric
input and curriculum learning holds significant promise for mitigating adversarial attacks without necessitating
adversary training.
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
Saudi Arabia stands as a titan in the global energy landscape, renowned for its abundant oil and gas resources. It's the largest exporter of petroleum and holds some of the world's most significant reserves. Let's delve into the top 10 oil and gas projects shaping Saudi Arabia's energy future in 2024.
2. Recap
C Course, Programming club, Fall 2008
2
C is a high-level language.
Writing a C code. {editors like gedit, vi}
Compiling a C code. {gcc –c test.c –o test}
Executing the object code. {./test}
3. Some more basics
C Course, Programming club, Fall 2008
3
Keywords
char, static, if , while, return ..................... Total= about 32
Data Types
int , char, float ...………..….. Some more later
Arithmetic Operators
+ (Plus), - (Minus), * (Multiplication), /(Division)
……….………. Some more later
4. My first C program!
C Course, Programming club, Fall 2008
4
#include <stdio.h>
// program prints hello world
int main() {
printf ("Hello world!");
return 0;
}
Output: Hello world!
5. Example 1
C Course, Programming club, Fall
2008
5
#include <stdio.h>
// program prints a number of type int
int main() {
int number = 4;
printf (“Number is %d”, number);
return 0;
}
Output: Number is 4
6. Example 2
C Course, Programming club, Fall
2008
6
#include <stdio.h>
// program reads and prints the same thing
int main() {
int number ;
printf (“ Enter a Number: ”);
scanf (“%d”, &number);
printf (“Number is %dn”, number);
return 0;
}
Output : Enter a number: 4
Number is 4
7. more and more
C Course, Programming club, Fall 2008
7
#include <stdio.h>
int main() {
/* this program adds
two numbers */
int a = 4; //first number
int b = 5; //second number
int answer = 0; //result
answer = a + b;
}
8. Note
C Course, Programming club, Fall 2008
8
Errors
Compilation
Compiler generally gives the line number at
which the error is present.
Run time
C programs are sequential making the
debugging easier.
9. Some more Data Types
C Course, Programming club, Fall
2008
9
Primary : int, float, char
int (signed/unsigned)(2,4Bytes): used to store integers.
char (signed/unsigned)(1Byte): used to store
characters
float, double(4,8Bytes): used to store a decimal number.
User Defined:
typedef: used to rename a data type
typedef int integer; can use integer to declare an int.
enum, struct, union
10. Some more Arithmetic Operators
C Course, Programming club, Fall 2008
10
Prefix Increment : ++a
example:
int a=5;
b=++a; // value of b=6; a=6;
Postfix Increment: a++
example
int a=5;
b=a++; //value of b=5; a=6;
11. Contd…
C Course, Programming club, Fall 2008
11
Modulus (remainder): %
example:
12%5 = 2;
Assignment by addition: +=
example:
int a=4;
a+=1; //(means a=a+1) value of a becomes 5
Can use -, /, *, % also
12. Contd…
C Course, Programming club, Fall 2008
12
Comparision Operators: <, > , <=, >= , !=, ==, !,
&&, || .
example:
int a=4, b=5;
a<b returns a true(non zero number) value.
Bitwise Operators: <<, >>, ~, &, | ,^ .
example
int a=8;
a= a>>1; // value of a becomes 4
13. Operator Precedence
C Course, Programming club, Fall 2008
13
Meaning of a + b * c ?
is it a+(b*c) or (a+b)*c ?
All operators have precedence over each other
*, / have more precedence over +, - .
If both *, / are used, associativity comes into
picture. (more on this later)
example :
5+4*3 = 5+12= 17.
14. Precedence Table
C Course, Programming club, Fall 2008
14
Highest on top
++ -- (Postfix)
++ -- (Prefix)
* / %
+ -
<< >>
< >
&
|
&&
||
15. Input / Output
C Course, Programming club, Fall 2008
15
printf (); //used to print to console(screen)
scanf (); //used to take an input from console(user).
example: printf(“%c”, ’a’); scanf(“%d”, &a);
More format specifiers
%c The character format specifier.
%d The integer format specifier.
%i The integer format specifier (same as %d).
%f The floating-point format specifier.
%o The unsigned octal format specifier.
%s The string format specifier.
%u The unsigned integer format specifier.
%x The unsigned hexadecimal format specifier.
%% Outputs a percent sign.
16. Some more geek stuff
C Course, Programming club, Fall 2008
16
& in scanf.
It is used to access the address of the variable used.
example:
scanf(%d,&a);
we are reading into the address of a.
Data Hierarchy.
example:
int value can be assigned to float not vice-versa.
Type casting.
17. Home Work
C Course, Programming club, Fall 2008
17
Meaning of
Syntax
Semantics of a programming language
Find the Output:
value=value++ + value++;
Value=++value + ++value;
value=value++ + ++value;
18. End of Today’s Lecture
C Course, Programming club, Fall 2008
18
Doubts && Queries?