• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 1 out of 3 pages
Summary

Résumé Fiche de révision SDA1 L1 IG2I — Structures de données statiques

Document preview thumbnail
Preview 1 out of 3 pages

Fiche de révision pour le cours SDA1 en L1 IG2I. Couvre les structures en C (struct), les fichiers binaires et texte, les piles (LIFO), les files (FIFO), les unions et les énumérations.

Content preview

Fiche de révision — Structures de données statiques L1 IG2I

1. Les Structures ( struct )

Permet de créer des types complexes (ex: Livre, Client).


Syntaxe & Mémoire


typedef struct {
char titre[60]; // Tableau statique
char auteur[20];
int annee;
} T_livre; // Alias du type
// T_livre L; -> Réserve 84 octets (60+20+4) en mémoire



Manipulation des Structures

Cas Syntaxe Exemple

Accès direct Point (.) L.annee = 2020

Via pointeur Flèche (->) T_livre *p = &L; p->annee = 2020


Astuce Mémo :

Variable → Point (VP)
Pointeur → Flèche (PF)



LE PIÈGE A ÉVITER
Interdit de faire if (L1 == L2) . Ça ne compile pas ou c’est faux.

Solution : Comparer la mémoire octet par octet.


#include <mem.h>
if (memcmp(&L1, &L2, sizeof(T_livre)) == 0) { /* Identiques */ }




2. Les Fichiers ( FILE * )

Deux modes distincts à ne pas mélanger.


Fichiers Binaires (Données brutes)
Pour stocker des structures entières ( T_livre , tableaux).

Ouverture : fopen("nom", "mode") (modes: "r" lecture, "w" écriture/écrasement, "a" ajout).

Écriture : fwrite(&var, taille, qté, fichier) .

Lecture : fread(&var, taille, qté, fichier) .

Navigation :

rewind(f) : Retour au début.

fseek(f, offset, WHO) : Sauter des octets.

SEEK_SET (Début), SEEK_CUR (Courant), SEEK_END (Fin).

Document information

Study
Uploaded on
April 22, 2026
Number of pages
3
Written in
2025/2026
Type
Summary
$4.61

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
0
Items
18
Last sold
-



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions