0% found this document useful (0 votes)
30 views17 pages

Mit C Lanf

This document provides an overview of C programming in Linux. It discusses fundamentals like compilers, libraries and headers. It explains that compilers convert human-readable code to machine-readable executables. Libraries provide reusable code without needing the source, and headers contain function prototypes. The document also offers migration tips, ways to get help, and recommends books for learning C programming in Linux.

Uploaded by

anirudhgargi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views17 pages

Mit C Lanf

This document provides an overview of C programming in Linux. It discusses fundamentals like compilers, libraries and headers. It explains that compilers convert human-readable code to machine-readable executables. Libraries provide reusable code without needing the source, and headers contain function prototypes. The document also offers migration tips, ways to get help, and recommends books for learning C programming in Linux.

Uploaded by

anirudhgargi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

CProgramminginLinux

AdityaGodbole CameoDigitalSystems MITCOE2009

Fundamentals

Fundamentals

LetusC... WhatisC?

YouusedVC?IdiditusingC.

Language

C,C++,Java,Lisp,Perl,Ruby

Compilers/Interpreters

Convertcodethathumansreadandwritetocode thatcomputerscanoperateon. TurboC,VC,GCC,IntelCcompiler,etc.

Executables

Codethatthecomputercanunderstand Headersthattheoperatingsystemcan understand Madeupofmanypartslinkedtoeachother

a.c Compile

a.o Link out.exe

b.c

b.o

c.c

c.o

d.c

d.o

lib.a/lib.so

Libraries

Advantages

Reusable Code need not be compiled every time with the rest of the files Source code not necessary to use the functionality Functionality that is part of the ANSI C standard. libx11, libqt, libcv, libblas, libfann1

Standard C library libc

Headers

C is strongly typed Prototype required to check function calls Prototypes (declarations) of functions stored in header libraries. Necessary to compile function calls to libraries.

GCC

gcc -o out -lm a.c b.c c.c

-o: Name of output executable -l: Name of libraries to be linked

Migrationtips

conio.h

Used typically for a getch Forget it, not needed Use getchar instead X11, Qt Graphics compatible library (incomplete). You can add on Compile with -lm

graphics.h

math.h functions

Use 'sizeof'. Don't assume that an integer is 16 bits or 32 bits Read and assign members of data structures individually fflush(stdin) does not work! Read the documentation of the standard library in detail Write modular code. Break your code into multiple files if required Use a good text editor for writing programs.

Help!!

Manual pages Detailed information about every command and even about libraries Google (or your favourite search engine) Specific mailing lists (or google groups). Follow the etiquettes of the group. Learn to ask. The best learners are those who ask the best questions. Share your knowledge. Its an integral part of getting help.

Mustreads

The C Programming Language, Brian Kernighan and Dennis Ritchie The Art of Unix programming, Eric Raymond Let Us C, Yashwant Kanitkar

Mustthrowaway

Let Us C, Yashwant Kanitkar

ThankYou

Questions?

You might also like