Download presentation
Presentation is loading. Please wait.
Published byEdward Carter Modified over 8 years ago
1
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
2
6 mainly All C program mostly contains following 6 constituents. Keyword Identifier Literal Comments Operators. Other keyword like tokens and aliases SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
3
Keywords Words which complier know the meaning. Like a word in dictionary. Very few in C. More keywords which are specific to compliers SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
4
Mostly used keywords in C auto double int struct break else long switch case enum register typedef char extern return union const float short unsigned continue for signed void default goto sizeof volatile do if static while SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
5
Demo Keywords Some Keywords int, void SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
6
Keyword It is required to know and understand the use of each keyword. Not that easy to get all in hand in the beginning. We will see one by one as we go. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
7
Identifier Name of something in the program. Compiler wont understand them before introducing them with keywords. Like a name of a person which normal not in the dictionary. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
8
Demo Identifier int a; SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
9
Literals Text and numbers normally. Text will be in double quotes - “”; Number are like 10, 0xAB ( hex ) etc. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
10
Operator + - * / % etc Some are bit confusing for beginners as mean of the operator kind of different from math. Example = is not “equal” but assignment. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
11
OperatorDemo + plus operator sample SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
12
Comment Not complied by the complier Mostly for the readability of code /* anything – even more than one line */ // single line file should be.cpp SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
13
Comments demo Some comment in C SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
14
Others Mostly understood by the complier mostly behave exactly like keywords from programmer standpoint. Example Preprocessor statement like #define, #include #pragma { } braces, ; semi colon Complier specific reserved keyword like __declspec is a reserved keyword ONLY in Microsoft C complier. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
15
Other ( Aliases ) One of the items we already discussed but the name will be different. Just kind of old wine in new bottle. Nothing new but causes a lot of confusion to beginners looking at production code. To many in production code. #define ( pre processor definitions )and typedef is mostly for implementing this. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
16
Alias or place holders #include place holder for contents in the file stdio.h SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
17
Example 1 #include void main () { printf (“hello world”); } SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
18
Example 2 // helloworld.cpp : Defines the entry. // #include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) { return 0; } SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
19
Conclusion Building blocks of the C. Over all discussion with out much details like preprocess directives, typedef etc. Don’t worry if are not able to understand completely at this point in time. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
20
Thank you SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.