





































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
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Notes in C for beginners , introduction to the command line
Typology: Lecture notes
1 / 45
This page cannot be seen from the preview
Don't miss anything!
The C Programming Language
− Ritchie is one of the authors of “The C Programming Language”
Sample 02-
Sample code 02-01: Simple C code
Preprocessor directive
Comments
Statements
Main function
Sample 02-
a = 10
Display a
Variable Declarations
− A name associated with a data whose value can change during program execution
− A name or label for a set of values and operations that can be performed on those values e.g. An integer can be added, subtracted, multiplied, etc
Variable Declaration Formats
<variable_list>; *variable_list are comma-separated names
/* Single declaration */ int count;
/* multiple declarations */ float miles, kms; int number1,
Identifier Rules
− letters [A,..,Z,a,...,z] − Digits [0,..,9] − Underscores _
− Valid identifiers: _abc, letter1, letter2, inches, Hello, VARiable − Invalid identifiers: 1_a, .name, (number
− inches and INCHES are not the same
Review
Classify the words as
(a) valid identifiers (b) invalid identifier
Reserved Identifiers
− Also known as Keywords
− Names that are not reserved but are used by the C standard libraries
Standard Identifiers
stdio.h math.h stdlib.h printf sqrt atof scanf exp atoi getc sin strtod
Use consistent naming style
(see our resources page for sample)
− No mixed cases (eg maxHeight)
− Keep it short (e.g. SMS lingo) − Single characters are OK for short codes
− LARGE and large − xcoord and x_coord