1CSSE 332Course IntroductionRoll Call and Introductions Name (nickname) Hometown Local Residence Major Something exciting you did over the breakAdministrivia Background Syllabus Schedule First assignment due at start of next class4Why learn C (after Java)? Both high-level and low-level language Better control of low-level mechanisms Performance better than Java Java hides many details needed for writing OS codeBut,…. Memory management responsibility Explicit initialization and error detection More room for mistakes5Goals of this tutorial To introduce you with some basic C concepts – you can read further details on your own To expose common mistakes beginners make– you can avoid them and get your assignments done quickly6Creating an executableSource: http://www.eng.hawaii.edu/Tutor/Make/1-2.html7Types of files C source files (.c) C header files (.h) Object files (.o) Executable files (typically no extension –by default : a.out) Library files (.a or .so)8Example 1: HelloWorld#include <stdio.h> //#include “myheader.h”intmain(){/* print out a message */printf(“Hello World. \n \t and you ! \n ”);return 0;}9Summarizing the Example #include <stdio.h> = include header file stdio.h– No semicolon at end – Small letters only – C is case-sensitive int main(){ … } is the only code executed printf(“ /* message you want printed */ ”); \n = newline \t = tab \ in front of other special characters within printf creates “escape sequences”. – printf(“Have you heard of \”The Rock\” ? \n”);10Compiling and running >gcc HelloWorld.c (Creates a.out) >./a.out (Runs the executable) >gcc HelloWorld.c –o HelloWorld(Creates HelloWorld not a.out) >./HelloWorldLinux and C Introduction Login to Angel Point your browser to “Course Resources” Expand the “Software Development Resources” link– Click on Introduction to Linux and C– Follow the tutorial. If you have any questions I am there to help HelloWorld.c is at Lessons Files to download Session 1 HelloWorld.cLinux and C Introduction Before step 3 “How to use Emacs” click on XWin32 Instructions and follow the instructions– .emacs file is at Lessons Files to download Session 1 my.emacs– Emacs reference card is at Course Resources Software Development Resources emacsreference
View Full Document