Cours - Programmation

145 documents à télécharger gratuitement

Cours de programmation partagés par des étudiants et des enseignants. Thèmes couverts : algorithmique, langage C, Java, Python, POO, structures de données.

Cours Algo 2 : Les Pointeurs

The document provides a comprehensive explanation of pointers in computer programming, covering both direct and indirect addressing techniques to access variables in memory. Core concepts such as pointer definitions, basic operators (& and *), and pointer arithmetic (addition, subtraction, and comparison) are detailed. Special functionalities, such as handling pointers in arrays and strings, are described, emphasizing pointer versatility and constraints. The material highlights differences between variables, pointers, and constants, emphasizing specificity in type compatibility and operations.

pointers
adressage direct
adressage indirect
5p0
Cours programmation en langage C - Chaînes de caractères

This document explains the handling of character strings in the C programming language, treating them as one-dimensional character arrays. Key concepts include memory allocation, initialization, and pointers, as well as differences between arrays and pointers for string manipulation. Examples of proper and improper string declarations are provided, along with demonstrations of character precedence and lexicographical ordering. Additionally, the document discusses libraries and functions designed for string processing, such as those in <stdio.h>, <string.h>, <stdlib.h>, and <ctype.h>.

character strings
ASCII codes
lexicographical order
15p0
Cours programmation en langage C : chaînes de caractères

This document covers the fundamentals of working with strings in the C programming language. It delves into concepts such as string declaration, memory allocation, initialization, and manipulation using pointers. Key examples illustrate correct and incorrect initializations and the nuances between arrays and pointers in handling strings. Additionally, the document explains built-in functions for string operations and key concepts like lexicographical precedence and character conversion.

chains of characters
lexicographical precedence
pointers
15p0
Cours programmation en langage C : Chapitre - chaînes de caractères

This document provides a comprehensive overview of handling strings in the C programming language. It covers the declaration, initialization, and memory allocation of character arrays, including the use of escape sequences and nuances such as null-terminated strings. Furthermore, it explores pointers in relation to strings, including their initialization and usage, along with advanced topics such as lexicographical precedence, string conversions, and tests. The document also discusses standard library functions and formatting techniques for input/output operations with strings.

strings
null character ('\0')
lexicographical precedence
15p0
Cours Programmation en Langage C - Chapitre: Les Fonctions

The document explains modular programming in C with the use of functions for structuring code. It highlights the advantages of modularity, including readability, reusability, and error reduction, and provides detailed examples such as calculating factorials, swapping variables, and building hierarchical structures. Additionally, it discusses concepts like local/global variables, function declaration, and parameter handling, emphasizing the difference between value and reference parameter passing.

functions
modular programming
variable scope
12p0
Cours Programmation en Langage C - Les Fonctions

This document explores the concept of modularity in programming using C functions, covering predefined functions and the structuring of programs into reusable modules to enhance readability and efficiency. Examples are provided, demonstrating key concepts such as variable scope, global versus local variables, and function declaration, definition, and invocation. Particular attention is given to functionality like loops, conditional blocks, parameter handling, and memory optimization. Practical coding examples such as calculating factorials, finding maximum values, calculating averages, and...

functions
modular programs
variable scope
12p0
Cours programmation en langage C: Les fonctions

The document covers the modularization of programs using functions in C programming to improve readability, reduce errors, and enhance efficiency. It introduces concepts like local and global variables, the definition and prototyping of functions, and parameter passing mechanisms. Various examples, including programs for factorial computation, rectangle drawing, value permutation, and computation of averages, illustrate the practical use of functions in C. Different function approaches are demonstrated to highlight the significance of local/global scope and pointer-based parameter handling.

modular programming
factorial calculation
function prototyping
12p0
Cours programmation en langage C : Chapitre 6 - Les pointeurs

This document is a detailed guide on pointers in C programming, covering direct and indirect addressing through variables and pointers. It explains the declaration, usage, and operations of pointers, including arithmetic and comparison. The relationship between pointers and arrays is explored, highlighting compact and efficient coding possibilities. Examples demonstrate pointer arithmetic, memory allocation principles, and usage scenarios for enhanced programming practices.

pointers
address operator (&)
dereference operator (*)
9p0
Cours Programmation en Langage C - Chapitre 6 : Les Pointeurs

This document, part of a programming course at École Supérieure de Technologie et d’Informatique, delves into the concept of pointers in the C programming language. It explains the fundamentals such as direct and indirect addressing, pointer syntax, and operations with pointers, emphasizing their role in memory management. The material includes detailed examples for using pointers with arrays, arithmetic operations, and differences between pointers and array names. Lastly, examples of pointer-based programs demonstrate their utility in writing compact and efficient code.

pointers
addressing operators & and *
pointer arithmetic
9p0
Les Pointeurs en Langage C

The document introduces pointers in C programming, discussing their definition, usage, and operations. It covers direct and indirect addressing, pointer initialization, basic operators '&' and '*', and interactions with arrays. Examples emphasize translating array indexing into pointer arithmetic for efficiency. Advanced concepts like pointer arithmetic, pointer comparisons, and pitfalls are illustrated with detailed code samples.

pointers
addressing
arrays
9p0
Cours programmation en langage C - Chapitre 3 : Les entrées sorties

This document provides an overview of input and output operations in the C programming language. It details the usage and functionality of standard I/O functions like printf and scanf as well as character-specific functions such as putchar and getchar. It also explains format specifiers and demonstrates how data is formatted and manipulated using these functions. Practical examples accompanying the explanations showcase the correct syntax and expected outcomes of using input/output functions.

stdio
printf
scanf
3p0
Cours Programmation en Langage C - Chapitre 3 : Les Entrées et Sorties

This document explains the standard library <stdio> in C for input-output operations. It categorizes the formatting symbols for functions like printf and scanf, which handle formatted data input and output. Multiple practical examples illustrate concepts such as left/right alignment, field width, and ASCII code usage with functions like putchar and getchar. Specific details are provided for reading, writing, and formatting various data types in C.

stdio
printf
scanf
3p0
Cours programmation en langage C - Chapitre 3 : Les entrées sorties

This document introduces input and output functions in the C programming language, covered in the third chapter of a programming course. Key standard functions, such as printf, scanf, getchar, and putchar, are explained alongside format specifiers for data representation and manipulation. Practical examples demonstrate the usage of these functions, including formatted data output, input reading, character writing, and ASCII operations. The document emphasizes correct handling of memory addresses for scanf and details specific examples for implementation and execution outputs.

C programming
printf
scanf
3p0
Cours programmation en langage C - Chapitre 2 : Opérateurs et expressions

This chapter introduces arithmetic, logical, relational, and assignment operators in the C programming language, explaining their syntax, functionality, and priority in expressions. It discusses implicit and explicit type conversions during operations, including rules for converting between types. Examples with accompanying source code demonstrate key concepts like operator precedence, casting, and the use of predefined functions from the math.h library for tasks such as calculating power and square roots. The chapter concludes with details on the use of conditional operators and the hierar...

operators in C
pow function
type conversion
7p0
Cours Programmation en Langage C : Opérateurs et Expressions

This document provides an in-depth explanation of arithmetic, relational, logical, and assignment operators in the C programming language, including details about operator precedence, implicit type conversion, and casting. Several code examples demonstrate the application of these operators, such as calculations involving modulo, square root, and ASCII character manipulation. The examples also highlight the importance of type hierarchy and casting for correct program execution. Additionally, it introduces a variety of mathematical functions from the 'math.h' library that are crucial in prog...

arithmetic operators
pow
type conversion
7p0
Cours programmation en langage C - Chapitre 2 : Opérateurs et expressions

This document provides an in-depth overview of operators and expressions in the C programming language. It explains fundamental arithmetic operators such as addition, subtraction, multiplication, division, and modulo, alongside unary operations. The text details rules governing operator precedence, implicit type conversions during operations, and the impact of data types in calculations. Additionally, it includes practical examples with predefined functions from the math.h library to compute tasks such as powers, square roots, and demonstrates casting, logical operators, and conditional exp...

arithmetic operators
pow function
operator precedence
7p0
Cours programmation en langage C

The document introduces the C programming language, emphasizing its foundational principles and syntax. It provides examples of code execution, memory operations, and input/output functions, explaining essential concepts such as data types, format specifiers, and preprocessor directives. In addition, it covers program structure, compilation steps, and guidelines for writing readable and efficient code. Finally, special focus is given to categorical concepts like variable declarations, numerical types, floating-point representation, and character encoding.

C programming
ANSI standards
Brian W. Kernighan
9p0
Cours programmation en langage C: Généralités

This document introduces fundamental concepts of the C programming language, describing memory allocation for variables, data types, and the structure of programs. Core methodologies include the use of functions like printf and scanf for input/output operations, memory referencing techniques, and creation of executable programs using preprocessor directives. Examples and practical exercises are included to illustrate basic programming constructs and rules, providing foundational knowledge for beginners.

Brian W. Kernighan
ANSI C
variables and memory allocation
9p0
Introduction to Programming in C - General Overview

This lecture document provides foundational knowledge about programming in C, including historical context, basic syntax, variable declaration, and types. It explains core functionalities such as printf for output and scanf for input, emphasizing memory management and data types like integers, floating-point numbers, and characters. The document introduces programming structure, compilation steps, and preprocessor directives, offering examples to illustrate concepts such as variable initialization, memory addressing, and formatted input/output. Additionally, the importance of identifiers, k...

Brian Kernighan
Denis M. Ritchie
variable types
9p0
Cours Programmation en Langage C : Structures Alternatives et Répétitives

This document from the École Supérieure de Technologie et d’Informatique (2011/2012) provides an in-depth instructional guide on implementing alternative and repetitive structures in the C programming language. It details essential conditional instructions such as if-else, switch-case, and structured branching using goto, break, and continue. Moreover, it explains and demonstrates iterative control structures like while, do-while, and for loops, integrating practical examples for each. Emphasis is placed on understanding syntax, logic flow, and choosing the correct construct for specific pr...

C programming
if-else
while loop
11p0
Cours programmation en langage C : Structures alternatives et répétitives

This document serves as a pedagogical resource focusing on alternative and repetitive structures in the C programming language. It elaborates on instructions like 'if-else,' 'switch-case,' and loops ('while,' 'do-while,' 'for'), with practical examples including decision-making and iterative processes. Key syntax and execution behaviors are discussed, emphasizing condition evaluation and structuring within blocks. Additionally, programmatic illustrations of constructs in real-world scenarios are included to aid comprehension.

C programming
if-else
switch-case
11p0
Cours programmation en langage C : Structures alternatives et répétitives

This document focuses on Chapter 4 of a programming course in the C language, covering conditional (if-else, switch-case) and iterative structures (while, do-while, for). It emphasizes the syntax, usage, and principles of structured programming, providing multiple programmatic examples for practical problem solving. The document also explains how to choose appropriate looping or branching methodologies based on program logic. Additionally, it highlights the use of specific constructs like break and their implications.

C programming
if-else
switch-case
11p0
Cours programmation en langage C: Chapitre 5 - Les tableaux

This document focuses on one-dimensional arrays in the C programming language and covers their definition, declaration, memory storage, initialization, and usage with examples. It explains how arrays are structured, accessed, and stored in memory, including details on initialization, reserving memory, and iterating over arrays using loops. Additional programming examples are provided to demonstrate working with arrays, including calculating sums and averages, reversing arrays, separating elements into sub-arrays, and finding minimum and maximum values with their indices.

arrays
C programming
programming examples
5p0
Cours programmation en langage C : Chapitre 5 - Les tableaux

This document presents a detailed discussion about arrays in the C programming language, including their definition, initialization, memory allocation, and common operations. It outlines key concepts with examples, such as one-dimensional array declaration, memory layout, and initialization. Practical examples of using arrays in various programming tasks like summation, reversing, splitting, and finding min/max values are also provided. Additionally, it emphasizes the importance of precise memory management and correct syntax when working with arrays.

arrays
int tab[5]
structured variables
5p0

Autres ressources en programmation