Title, Topic

C Referenz .doc

®
Page 1 of 2
[1] [2]
Faculty
Information Science
Discipline
Information Technology / Computer Science
Document category
Summary
University, School
Fachhochschule Kempten - FH
Additional information
Responsible User
This text has been add by user asim737 on 2009-07-05. Disclaimer
Popularity
727  visits
Document length
~2.024  Words
~13.048  Chars
Rating
Networking ©




















More documents
Information Technology / Computer Science

Logiksimulator
/** * Beschreiben Sie hier die Klasse Nand. * * Nand ist eine Klasse, die ein Gatter erzeugt welches spezifiziert wird durch beliebig viele Eingänge und einen * Ausgang. Sie wird dadurch in de


RAID redundant array of indendent disks
RAID von FGT 1-2 der GBS Nordhorn Nordhorn den 27.11.2009 Inhaltsverzeichnis­ RAID im Allgemeinen. 3 RAID Level 0. 4 Allgemeines. 4 Vorteile. 4 Nachteile. 4 RAID Level 1.


Modellierung Entity Relationship Diagramm ER - Kino
Bsp: KINO · Modellieren Sie diesen Sachverhalt in einem ER-Diagramm mit und ohne Nullwerte und erstellen Sie die entsprechenden Relationenmodelle.­ Allgemeines: Kunde kauft Ticket, dadurc


Laufwerke und Speichermedien
ITS Themen: 1. Laufwerke und Speichermedien 1.1 Laufwerke und Speichermedien Laufwerk = elektromagnetische­s Gerät, dass Daten auf einem Träger dauerhaft zu speichern und/oder zu lesen. M

Swap your documents
Benutzerdefinierte Suche

C Referenz

1. Datentypen, Operatoren und Ausdrücke. 2

a. Low-Byte / High-Byte. 2

b. typedef. 2

c. Konstanten. 2

d. Aufzählungskonstanten. 2

e. Variablenvereinbarung. 2

f. Typkonvertierungen. 3

i. Implizite Typkonvertierung. 3

ii. Explizite Typkonvertierung. 4

g. Arithmetische Operatoren. 4

h. Vergleichsoperatoren. 4

i. Zuweisungsoperatoren. 4

j. Logische Operatoren. 4

k. Operatoren zu Bit- Manipulation. 5

l. Sonstige Operatoren. 5

2. Ein- und Ausgabe. 5

a. Funktion scanf. 5

b. Funktion printf. 5

3. Kontrollstrukturen. 6

a. if - / if – else – Anweisung. 6

b. 4.2 switch-Anweisung. 6

c. for-Anweisung: 6

d. while- und do-Anweisung. 7

e. continue- und break-Anweisung. 7

4. Funktionen. 8

a. Funktionsdeklaration und Funktionsdefinition. 8

b. Übergabe von Argumenten und Rückgabewerten. 8

c. Gültigkeitsbereich und Lebensdauer von Variablen. 9

5. Pointers und Vektoren. 10

a. Pointers. 10

b. Argument – Übergabe an Funktionen. 11

c. Vektoren. 11

d. Zusammenhang zwischen Pointer und Vektor. 11

e. Pointer-Arithmetik. 12

6. Strukturen Datentypen. 13

7. Unions. 14

a. Bit-Felder. 14

1.     Datentypen, Operatoren und Ausdrücke

a.     Low-Byte / High-Byte

This paragraph has been concealed!
Download the complete document for free!
C Referenz.doc
• Click on download to get complete and readable text
• This is a free of charge document sharing network
• First upload your own document, and you get a word document per email
• No registration necessary, gratis
Swap homeworks and notes at no charge!
Gratis scripts for students and pupils!

b.     typedef

type_def.h

/*** Definition of global types ***/
typedef unsigned char U_INT8;
..


programm.c

#include >type_def.h>
main()
{
U_INT8 variable1, .., variablen;
}

c.      Konstanten

84U à unsigned int 84
84 L à long ing 84
84 UL
à unsigned long int 84
1.475e-3F
à float
‛A’
à vom typ int (Wert anhand der ASCII Tabelle)
printf(“\”abc\””);
à //“abc”

d.     Aufzählungskonstanten

typedef enum {OFF, ON} KEY; // OFF=0 und ON=1

e.     Variablenvereinbarung

#define MAX_VAL 300 // präprozessoranweisung
const unsigned char test=2; //Wert nach initialisierung nicht änderbar
volatile unsigned char test=2; // variable bleibt unbeachtet in Compileroptimierung

f.       Typkonvertierungen

-bei Verknüpfung von Operanden mit unterschiedlichem Datentyp, ist Datentyp-Umwandlung erforderlich.

                                  i.      Implizite Typkonvertierung

Compiler nimmt automatisch Typkonvertierung vor.

o   für einen Ausdruck gilt u.a.:

- ist ein Operand long double, werden andere Operanden in long double konvertiert

Hierachie - ist ein Operand double, werden andere Operanden in double konvertiert

- ist ein Operand float, werden andere Operanden in float konvertiert

- Operand vom Typ char u. short werden in int konvertiert

- ist ein Operand long, werden andere Operanden in long konvertiert

- ist ein Operand unsigned int, werden andere Operanden in undsigned int konvertiert

o   Beachte:

·         float-Op. Werden nicht automatisch in Typ double konvertiert

This paragraph has been concealed!
Download the complete document for free!
C Referenz.doc
• Click on download to get complete and readable text
• This is a free of charge document sharing network
• First upload your own document, and you get a word document per email
• No registration necessary, gratis
Swap homeworks and notes at no charge!
Gratis scripts for students and pupils!

Ø  Integrer – Erweiterung

o   Konvertierung char, short int in int, wenn int zur Wertaufnahme ausreicht, sonst in unsigned int

o   C definiert nicht, ob char- Variable Vorzeichen besitzen à Konvertierung char-Variable in int-Variable maschinenabhängig z.B.:

char val1 = 0x84;
short int val3;
val3 = val1; // val3=0x0084 oder val3=0xFF84

o   eindeutige int-Konvert.:

unsigned char val1 = 0x84;
signed char val2 = 0x84;
short int val3;
val3=val1; // val3=0x0084
val3=val2; // val3=0xFF84

                                ii.      Explizite Typkonvertierung

o   Anweisung Typumwandlung eines Ausdrucks mittels cast-Operator:
(type_name) expression ..

o   Typumwandlung des Wertes von eypression in Typ type_name entsprechender Typkonvertierungsregeln z.B.:
Bibliotheksfkt. sqrt ( n ) mit n vom Typ double
#include <math.h>
unsigned int m_val;
double result;
result = sqrt ((double) m_val);

o   bei Zugriff auf Absolutadressen ist expl. Typkonvertierung erforderlich

o   Beachte:
-int-Werte mit „gr. Bereich“ werden in int-Werte mit „kl. Bereich“ konvertiert, durch Abschneiden überzähliger Bits von links her
-bei Typumwandlung float in int wird Bruchteil abgeschnitten
- Typkonvertierung double in float ist implementationsabhängig.

 

g.      Arithmetische Operatoren

% Modulo-Division // 8 % 3 à =2

o   Bei division von int-Werten wird gebrochener teil Abgeschnitten

o   Auf float- u.- double-Werten %-Op, nicht anwendbar

This paragraph has been concealed!
Download the complete document for free!
C Referenz.doc
• Click on download to get complete and readable text
• This is a free of charge document sharing network
• First upload your own document, and you get a word document per email
• No registration necessary, gratis
Swap homeworks and notes at no charge!
Gratis scripts for students and pupils!

o   numer. Wert vergleichsoperation:
1: Vergleich trifft zu (true)
0: Vergleich trifft nicht zu (false)

i.        Zuweisungsoperatoren

o   expr2 op = expr2 // Äquival.: expr1 = (expr1) op (expr2)

j.        Logische Operatoren

o   && log. UND

o   || log. ODER

o   ! log. Negation
Negationsoperator ! besitzt Wert:
1 wenn Operand = 0
0 wenn Operand ≠ 0
Test auf ungleich 0 à If (x) statt if (x!= 0)
Test auf 0 à If (!x) statt if (x== 0)
if((val1>val2)&&(val3++<val4)) à gefährlich!
Auswertung von links nach rechts, abgebrochen, sobald Resultat feststeht !!!

k.      Operatoren zu Bit- Manipulation

o   Bit-.Operatoren:
& UND
| ODER
^ Exklusiv – ODER
<< Shift left inbyte <<=0x03 à 3 NULL-Bits von rechts
>> Shift right outbyte >>=0x03 à 3 NULL Bits von links (unsigned)
à Vorzeichen Bit oder NULL Bit bei (signed)
~ Bit – Komplement

l.        Sonstige Operatoren

o   konditionaler Operator ?:
- Max_temp=(temp1>temp2) ? temp1:temp2;
expr1 ≠ 0: condition true à Berechnung expr2
expr1 = 0: condition false à Berechnung expr3
àResultatwert ist Wert des ermitt. Ausdrucks

o   Operator sizeof
length=sizeof array;
length=sizeof(long double);
à liefert Anzahl an Bytes zur Speicherung

 

2.     Ein- und Ausgabe

scanf Lesen von Zeichen aus Standard-Eingabe

fscanf Lesen von Zeichen aus einer Datei

getchar Lesen eines Zeichens aus Standard-Eingabe

This paragraph has been concealed!
Download the complete document for free!
C Referenz.doc
• Click on download to get complete and readable text
• This is a free of charge document sharing network
• First upload your own document, and you get a word document per email
• No registration necessary, gratis
Swap homeworks and notes at no charge!
Gratis scripts for students and pupils!

fprintf Ausgabe von Zeichen in Datei

putchar Ausgabe eines Zeichens auf Standard-Ausgabe

Voraussetzung für Verwendung E/A-Funktionen: #include <stdio.h>

a.      Funktion scanf

Scanf(“formatangaben“ , &arg1 , &arg2,..);

Scanf(“%d %f %c %x”, &wert, &var, &zei, &addr); à %d gehört zu &wert, %c gehört zu &zei ..

b.     Funktion printf

Printf(“formatangaben“, arg1, arg2, ..);Ausgabe Text u. Daten:

z.B.: printf(“Spannung u1: %fV“, u_1);

3.     Kontrollstrukturen

a.      if - / if – else – Anweisung

o   allg. Form:

if (expression)
{
statement_1;
next_statement;
}

else
statement_2;

o   ohne {} immer nur für einen Anweisungsblock gültig

b.     4.2 switch-Anweisung

o   allg. Form

switch (expression) switch(x)
{ {
case const_1: statement; case 5: y = 1000;
case const_2: statement; ..
..
case const_n: statement;
default: statement;
}
next statement;

o   es gilt
-Wert von expression: int-Typ
-const_i: ganzz. Konstante, konst. Ausdruck
-default ist optional
-mehrere case-Konstanten vor einem statement
-switch-Anw. können verschachtelt werden
-break; Verlassen switch-Anweisung

c.      for-Anweisung:

o   allg. Form:

for(expr1; expr2; expr3;)
{
statements;

}

This paragraph has been concealed!
Download the complete document for free!
C Referenz.doc
• Click on download to get complete and readable text
• This is a free of charge document sharing network
• First upload your own document, and you get a word document per email
• No registration necessary, gratis
Swap homeworks and notes at no charge!
Gratis scripts for students and pupils!

Page 1 of 2
[1] [2]


swopdoc.com ist not responsible for the content of this text provided by third parties

Legal info - Copyright - General terms - Partner - Statistik - Contact

Swap your documents