An Introduction to C Programming .


56 views
Uploaded on:
Category: Sales / Marketing
Description
Learning Objectives. Figure out how to compose and aggregate a C programLearn what C libraries areUnderstand the C variable typesUnderstand how to utilize if and if/else statementsUnderstand how to utilize the for structure. Step by step instructions to Write and Compile C Programs. C, C and JavaCompilers: Microsoft Visual C , GCC, Borland CSince we will be dealing with PCs:Microsoft Visual C Open new Win32 Console ApplicationName i
Transcripts
Slide 1

An Introduction to C Programming Geb Thomas

Slide 2

Learning Objectives Learn how to compose and gather a C program Learn what C libraries are Understand the C variable sorts Understand how to utilize if and if/else proclamations Understand how to utilize the for structure

Slide 3

How to Write and Compile C Programs C, C++ and Java Compilers: Microsoft Visual C++, GCC, Borland C Since we will chip away at PCs: Microsoft Visual C++ Open new Win32 Console Application Name it (in "venture name") Click "a welcome world application" Go to document see, source records, then the name of your project.cpp

Slide 4

Some Things About C Case matters, white space does not Comments go between/* and */Each announcement is trailed by a semicolon Execution starts in the fundamental capacity: int main(int argc, char* argv[]) {/* disregard this *//* begin here */return 0;/*end here */}

Slide 5

What are C libraries? C is a lightweight dialect. The greater part of its insight is compartmentalized in libraries. All c programs utilize the "stdio" or standard information/yield library. Many likewise utilize the "math" library. To utilize a library, incorporate the header document (I.e., "stdio.h") at the highest point of the record. For most uncommon reason libraries (I.e., math) you have to incorporate the library on the connection line. In Visual C++, go to extend >settings->object/module libraries.

Slide 6

C Variable Types The most well-known sorts are: singe, int, buoy, and twofold. Strings are varieties of characters (we\'ll cover exhibits later). Pronounce a variable before you utilize it: int x;/* announces a number called x. Its esteem is not appointed. */skim y, z = 3.14159;/* announces two skimming point numbers. z is set equivalent to pi */z = 4;/* now z is equivalent to 4 */myVal = 2;/* This would be a mistake, in light of the fact that myVal was not yet announced */

Slide 7

Logical Operators C characterizes these coherent administrators: <, >, <=, >= and == (the equality administrator) You can analyze any factor. Characters are looked at in view of their ASCII values. All answers will be valid (not zero) or false (0) You can broaden the rationale with && (and), ~ (not) and || (or).

Slide 8

The If Statement Syntax: if (expression) explanation; If the expression is valid (not zero), the announcement is executed. On the off chance that the expression is false, it is not executed. You can aggregate various expressions together with props: if (expression) { proclamation 1; explanation 2; articulation 3; }

Slide 9

The If/Else Statement Syntax: if (expression) statement_1; else statement_2; If the expression is valid, statement_1 will be executed, something else, statement_2 will be. in the event that (myVal < 3) printf("myVal is under 3.\n"); else printf("myVal is more prominent than or equivalent to 3.\n");

Slide 10

The For Loop Syntax: for (instatement; test; increase) {statements;} The for circle will first play out the introduction. At that point, as long is test is TRUE, it will execute explanations. After every execution, it will increase. for (cntr = 0; cntr < 3; cntr = cntr + 1) { printf(" Counter = %d\n", cntr); } Counter = 0; Counter = 1; Counter = 2;

Slide 11

Learning Objectives Learn how to compose and aggregate a C program Learn what C libraries are Understand the C variable sorts Understand how to utilize if and if/else explanations Understand how to utilize the for structure

Recommended
View more...