Report home > Computer / Internet

Tutorial on C Language Programming

2.69 (13 votes)
PDFCast is not affiliated with the authors of this page or responsible for its content.
This HTML preview only show 10 first pages of the document. Please download to read full content.
Tutorial on C Language
Programming
Teodor Rus
rus@cs.uiowa.edu
The University of Iowa, Department of Computer Science
Introduction to System Software – p.1/64

Tutorial on C programming
C program structure:
Data structure
Control structure
Program structure
Introduction to System Software – p.2/64

Data structures
Prede?ned data types:
integer (int), small integers (short), large integers
(long)
real numbers (?oat), large real numbers (double)
character data (char)
User de?ned data types using type constructors array,
record, pointer, ?le

Introduction to System Software – p.3/64

Declarations
A data object of a de?ned type T is declared using the
construct of the form T data where T is a type expression
and data is the data object name
Example:
int x declares x an object of type integer
short x declares x an object of type small integer
long x declares x an object of type large integer
?oat x declares x an object of type real
double x declares x an object of type large real
char x declares x an object of type character
Introduction to System Software – p.4/64

De?nitions
An object of a user de?ned type T is constructed using
one of the type constructors struct, [], *, FILE that takes
as arguments objects of already de?ned types.
A new user de?ned type T is constructed using the
meta-constructor typedef and a type or a type
constructor
Introduction to System Software – p.5/64

Record type de?nition
A record type is de?ned using the struct constructor
following the template:
struct TypeName
{
component1;
component2;
component3;
}
Components are object declarations of the form T
ObjName;

Note: TypeName is an abstraction
Introduction to System Software – p.6/64

Record object declaration
An object of type TypeName is obtained by the
declaration
TypeName MyRecord
One can put together the de?nition and the declaration
getting:
struct TypeName
{
component1;
component2;
component3;
} MyRecord;
Introduction to System Software – p.7/64

Example record
Example of a record type de?nition and declaration is:
struct Data
{
int Day;
int Month;
int Year;
} MyData, *MyPT, MyArray[Max];
Note: type expressions are obtained by combining the
type constructors struct, *, [], in a well de?ned manner
Introduction to System Software – p.8/64

Reference to record components
MyData.Year, MyData.Month, MyData.Day are
references at the components of the data object
MyData
M yP T ? > Y ear, M yP T ? > M onth, M yP T ? > Day are
pointer reference to the same components.
Note, we need to use MyPT = &MyData before this
reference make sense; i.e.,
M yP T ? > Y ear ? (?M yP T ).Y ear.
Introduction to System Software – p.9/64

Memory representation of records
Consider the following de?nition and declarations:
struct example
{
int x;
int *y;
} Obj, *PtObj;
Introduction to System Software – p.10/64

Document Outline
  • Tutorial on C programming
  • Data structures
  • Declarations
  • Definitions
  • Record type definition
  • Record object declaration
  • Example record
  • Reference to record components
  • Memory representation of records
  • Memory representation
  • Memory representation of PtObj
  • Facts about records
  • Array data type
  • Array memory representation
  • Union data type
  • Reference to union components
  • Example of a union usage
  • Reference to union components
  • Pointer data type
  • Example pointers
  • Pointer references
  • File data type
  • Operations with file
  • User defined types
  • Examples
  • Control Flow Structures
  • C language computation units
  • Assignment statement
  • Branching statements
  • If-statement
  • If-else statement
  • Switch statement
  • Break statement
  • Continue statement
  • Unconditional jump statement
  • Looping statements
  • While statement
  • Do-while statement
  • For statement
  • Block statement
  • Function definition
  • Example
  • Function declaration
  • Function call
  • Parameter passing
  • Remember
  • Function memory representation
  • Activation record
  • Structure of a function in memory
  • Structure of a C language program
  • Note
  • Macro definition component
  • Global declarations
  • Main function of the program
  • Program execution
  • Other function components
  • Example program
  • Bonus point assignment
  • Program memory representation
  • Data segment
  • Text segment
  • Stack segment
  • Development of a C program

  • Description
  • Document Detail
  • Submitter
Tutorial on C Language Program
Teodor Rus
The University of Iowa, Department of Computer Science
  • Username: desantis
  • Name: desantis
  • Documents: 37

Add New Comment




Related Documents

Tutorial on C Language Programming

by: desantis, 64 pages

Tutorial on C Language Program Teodor Rus The University of Iowa, Department of Computer Science

THE EFFECTS OF AGE AND MOTIVATION FACTORS ON SECOND LANGUAGE ACQUISITION

by: shinta, 8 pages

Learner is affected by many factors in the second language acquisition process. The level of cognitive development, socio-economic and cultural background, and the ability to acquire a ...

Inhibitory Effects of Ginseng Saponins on c-fos mRNA Expression and the Proliferation of Rat Aortic Vascular Smooth Muscle Cells Stimulated by Angiotensin II

by: shinta, 7 pages

To evaluate the possibility that the ginseng saponins could be developed as an anti-arteriosclerotic agent, we examined the inhibitory effects of ginseng saponins (total saponin[TS], ...

C Programming Tutorial

by: desantis, 410 pages

This book is a tutorial. Its aim is to teach C to a beginner, but with enough of the details so as not be outgrown as the years go by. It presumes that you have some previous acquittance with ...

C++ Programming Style Guidelines

by: dutcher, 22 pages

This document lists C++ coding recommendations common in the C++ development community. The recommendations are based on established standards collected from a number of sources, individual ...

iPhone Application Programming Guide

by: manualzon, 208 pages

Downloadable free ebook on iPhone Application programming guide so you can learn to program your own iPhone based on Mac OSX operating system

Motif Programming Manual, Vol 6A

by: manualzon, 776 pages

free ebook oreilly motif programming manual, It is a source for complete, accurate, and insightful guidance on Motif application programming. There is no other book that covers the ground as ...

The effects of drying and rewetting cycles on carbon and nitrogen dynamics in soils of differing textures and organic matter contents

by: shinta, 97 pages

Many researchers have reported differences in soil C and N dynamics between soils of different textures and/or soil organic matter contents. However, it has proven difficult to determine ...

Java for WebObjects Developers

by: manualzon, 113 pages

ebook on Java Programming a Tutorial for developers, Java for WebObjects Developers.pdf. From Free ITebooks, that offers able ebooks on computer and programming

Report of the Foundational Writing Skills Course Committee

by: shinta, 10 pages

As of Sept. 2006, SFU’s new curriculum, writing requirements and admissions criteria will require that all applicants demonstrate their competence in English as a part of the admissions ...

Flash Lite Authoring Guidelines for the i-mode Service by NTT DoCoMo

by: manualzon, 48 pages

Free ebook on Flash Lite for the i-mode Service by NTT DoCoMo.pdf. Download this free ebook on Flash Lite Programming

Download
Tutorial on C Language Programming

 

 

Your download will begin in a moment.
If it doesn't, click here to try again.

Share Tutorial on C Language Programming to:

Insert your wordpress URL:

example:

http://myblog.wordpress.com/
or
http://myblog.com/

Share Tutorial on C Language Programming as:

From:

To:

Share Tutorial on C Language Programming.

Enter two words as shown below. If you cannot read the words, click the refresh icon.

loading

Share Tutorial on C Language Programming as:

Copy html code above and paste to your web page.

loading
Wiring Diagrams, Pontiac Repair, Haynes Manual, Repair Manual, BMW Repair Manual, Mitsubishi Repair, JCB Manual, Nissan Patrol, Chilton Auto Repair Manual, Data Mining

ford service repair owners workshop manuals listing, hp 12c platinum financial calculator user s guide, a guide to the project management body of knowledge, solution manuals and test banks 2, using business intelligence solutions for achieving organization s strategy arab international unive, benchmark six sigma green belt training brochure, core competencies for early care and education professionals, valves, vw transmission disassembling and assembling overhaul procedure 096