ebook img

Programmation en C norme ANSI Guide de l'étudiant PDF

350 Pages·2000·0.73 MB·French
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Programmation en C norme ANSI Guide de l'étudiant

Programmation en C norme ANSI Référence : L1 Guide de l’étudiant une division de Sun Microsystems France S.A. Service Formation BP 53 13, avenue Morane-Saulnier 78142 Vélizy Cedex tél : (1) 30 67 50 50 fax : (1) 30 67 52 35 Révision C, Décembre 1994 Document non révisable Credits and Trademarks Copyright(cid:211) 1994 Sun Microsystems, Inc. 2550 Garcia Avenue, Mountain View, California 94043-1100 All rights reserved. No part of this work covered by copyright hereon may be reproduced in any form or by any means—graphic, electronic, or mechanical, including photocopying, recording, taping, or storage in an information retrieval system— without the prior written permission of the copyright owner. The OPEN LOOK and the Sun Graphical User Interface were developed by Sun Microsystems, Inc. for its uses and licenses. Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. Sun holds a non-exclusive license from Xerox to the Xerox Graphical User Interface, which license also covers Sun’s licenses. RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure by the U.S. government is subject to restrictions set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 52.227-7013 [October 1988] and FAR 52 227-19 [June 1987]. The products described in this manual may be protected by one or more U.S. patents, foreign patents, and/or pending applications. TRADEMARKS The Sun logo, Sun Microsystems, Sun Workstation, SunLink, Sun Core, The Font Department, ImageSource, Interpersonal, NeWS, NeWSware, NFS, PC-NFS, TypeMaker, and TypeScaler are registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SunOS and SunView are unregistered trademarks of Sun Microsystems, Inc. UNIX and OPEN LOOK are registered trademarks of UNIX Systems Laboratories, Inc. PostScript is a registered trademark of Adobe Systems, Inc. Adobe also owns copyrights related to the PostScript language and the PostScript interpreter. The trademark PostScript is used herein only to refer to material supplied by Adobe or to programs written in the PostScript language as defined by Adobe. X Window System is a product of the Massachusetts Institute of Technology. SPARC is a registered trademark of SPARC International, Inc. Products bearing the SPARC trademark are based on an architecture developed by Sun Microsystems, Inc. SPARCstation is a trademark of SPARC International, Inc., licensed exclusively to Sun Microsystems, Inc. Yellow Pages is a registered trademark in the United Kingdom of British Telecommunications plc., and may also be a trademark of various telephone companies around the world. Sun will be revising future versions of software and documentation to remove references to Yellow Pages. All other products or services mentioned in this document are identified by the trademarks or service marks of their respective companies or organizations and Sun Microsystems, Inc. disclaims any responsibility for specifying which marks are owned by which companies or organizations. Table des Matières Structures Fondamentales d’un Programme en C 1 Opérateurs Logiques et Relationnels dans les Expressions Conditionnelles 2 Fonctions et <stdio.h> 3 Introduction au Compilateur C et au Préprocesseur 4 Structures Itératives 5 Tableaux 6 Classes d’Allocation 7 Pointeurs et Adresses 8 Chaînes et Caractères 9 Structures, Unions, Définition de Type et Enumérations 10 Opérateurs sur Bits 11 Passage d’Arguments à main() 12 Entrées/Sorties Fichiers Standard 13 Plus sur cc et le Préprocesseur 14 Allocation Dynamique de Mémoire 15 Introduction aux Fonctions Récursives (facultatif) 16 i SunService Reproduction Interdite Annexes Conseils de Mise au Point A Mots-Clefs et Table ASCII B Mémento du C C Mémento vi D Savoir Lire le C E Exemples de Programmes Divers F Internationalisation, Grands Caractères et Caractères Multi-octets G Différences entre Sun C et Sun ANSI C H Programmes des Travaux Pratiques I Index ii Programmation en C norme ANSI Révision C, Décembre 1994 Structures Fondamentales d’un Programme en C 1 Objectifs n Ecrire des programmes C syntaxiquement corrects. n Identifier les éléments d’un programme C. n Faire correspondre opérateurs et opérations. n Identifier et déclarer les types de base. Evaluation Travaux Pratiques 1 et révision de module. 1-1 1 SunService reproduction interdite Compilation Simple n Le code source C doit être mis dans un fichier dont le nom se termine par .c n Utiliser la commande cc avec l’option -Xc pour compiler les programmes C ANSI. n Si la compilation réussit, le fichier exécutable sera appelé a.out par défaut. % cc -Xc prog.c % a.out <affichage de résultats s’il y en a> 1-2 Programmation en C norme ANSI Révision C, Décembre 1994 1 reproduction interdite Caractéristiques du C n Bas niveau - haut niveau n Très Portable n Mise en forme libre n Aucune possibilité d’Entrée/Sortie intégrée : beaucoup de fonctions en librairie Standard Structures Fondamentales d’un Programme en C 1-3 1 SunService reproduction interdite Introduction au Source C-La Fonctionmain() Tout programme C doit contenir la fonction main(): La fonction C universelle main() et une fonction de sortie-écran: /* Voilà la fonction "main" et içi des commentaires. */ int main (void) { printf("Bienvenue en Programmation C!"); return 0; } liste de paramètres entre parenthèses (pas d’argument dans l’exemple) corps de fonction (ou bloc) entre 2 accolades nom de fonction commentaires entre les marques "/*" et "*/" 1-4 Programmation en C norme ANSI Révision C, Décembre 1994 1 reproduction interdite Eléments de Base d’un Programme C Un programme C se compose de déclarations et d’instructions. /* Ceci montre uniquement un squelette de programme. Ce n’est pas un programme compilable */ int main(void) { <data type> <identifier>; /* déclaration */ <data type> <identifier, identifier, ...>;/* déclaration */ <data type> <identifier> = <value>;/* initialisation */ <statements> /* instructions */ return 0; } /* fin de la fonction main() */ Structures Fondamentales d’un Programme en C 1-5 1 SunService reproduction interdite Types de Données n Ci-dessous, la liste des types du C et leurs tailles sur une SPARCstation™: mot-clef description Taille en octets char caractère 1 short entier court 2 int entier 4 long entier long 4 float réel simple précision 4 double réel double précision 8 long double réel en précision étendue 16 void aucune valeur 0 n Les types char, short, int, et long peuvent être précédés des attributs de types signed et unsigned. Exemples: signed char ch; unsigned int compteur; unsigned long nombre; 1-6 Programmation en C norme ANSI Révision C, Décembre 1994

Description:
fax : (1) 30 67 52 35. Programmation en C norme ANSI. Révision C, Décembre 1994. Document non révisable. Référence : L1. Guide de l'étudiant
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.