Download presentation
Presentation is loading. Please wait.
1
1 CSSE 332 Course Introduction
2
Roll Call and Introductions Name (nickname) Name (nickname) Hometown Hometown Local Residence Local Residence Major Major Something exciting you did over the break Something exciting you did over the break
3
Administrivia Background Background Syllabus Syllabus Schedule Schedule First assignment due at start of next class First assignment due at start of next class
4
4 Why learn C (after Java)? Both high-level and low-level language Both high-level and low-level language Better control of low-level mechanisms Better control of low-level mechanisms Performance better than Java Performance better than Java Java hides many details needed for writing OS code Java hides many details needed for writing OS code But,…. But,…. Memory management responsibility Memory management responsibility Explicit initialization and error detection Explicit initialization and error detection More room for mistakes More room for mistakes
5
5 Goals of this tutorial To introduce you with some basic C concepts To introduce you with some basic C concepts –you can read further details on your own To expose common mistakes beginners make To expose common mistakes beginners make –you can avoid them and get your assignments done quickly
6
6 Creating an executable Source: http://www.eng.hawaii.edu/Tutor/Make/1-2.html
7
7 Types of files C source files (.c) C source files (.c) C header files (.h) C header files (.h) Object files (.o) Object files (.o) Executable files (typically no extension – by default : a.out) Executable files (typically no extension – by default : a.out) Library files (.a or.so) Library files (.a or.so)
8
8 Example 1: HelloWorld #include //#include “myheader.h” int main(){ /* print out a message */ printf(“Hello World. \n \t and you ! \n ”); return 0; }
9
9 Summarizing the Example #include = include header file stdio.h #include = include header file stdio.h –No semicolon at end –Small letters only – C is case-sensitive int main(){ … } is the only code executed int main(){ … } is the only code executed printf(“ /* message you want printed */ ”); printf(“ /* message you want printed */ ”); \n = newline \t = tab \n = newline \t = tab \ in front of other special characters within printf creates “escape sequences”. \ in front of other special characters within printf creates “escape sequences”. – printf(“Have you heard of \”The Rock\” ? \n”);
10
10 Compiling and running >gcc HelloWorld.c (Creates a.out) >gcc HelloWorld.c (Creates a.out) >./a.out (Runs the executable) >./a.out (Runs the executable) >gcc HelloWorld.c –o HelloWorld (Creates HelloWorld not a.out) >gcc HelloWorld.c –o HelloWorld (Creates HelloWorld not a.out) >./HelloWorld >./HelloWorld
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.