Docsity

C Programming: Identifiers, Linkage, and Storage Classes, Study notes of Computer Science

Partial preview of the text

Download C Programming: Identifiers, Linkage, and Storage Classes and more Study notes Computer Science in PDF only on Docsity!

CS

Introduction To C Lawrence Angrave

Crash course in C

char * search(char*) { char result[100]; … do stuff return result; }

static int debug=1; main(…) { }

Linkage & Scope

Linkage

Identifiers (variables & functions) visible to another c file? Main.c = Compilation unit Myutils.c = Another compilation unit Static : No!

main.c

Refer to runsuperfast and die? extern int runsuperfast; void die(char *mesg);

main.c

Refer to runsuperfast and die? void die(char *); // declaration! extern int runsuperfast;

C Compiler

gcc Gnu Compiler

Many options! man gcc Three for the price of one Preprocessor Compiler Linker

Pointers

Pointers

How to shoot yourself in the foot and not realize it

int *p

What is the value of p == &*p; p[0] == *p

char **argv

Explain this to your neighbor