Download presentation
Presentation is loading. Please wait.
1
Summary CSE 2031 Fall 20101 5 May 2019
2
C Basics Data types and type conversion
Precedence and order of evaluation Control flows Functions Passed by value Passed by reference I/O: getchar, printf, scanf File access
3
Precedence and Order of Evaluation
3
4
Structures Structures and functions Arrays of structures
Pointers to structures Passed by value Passed by reference Self-referential structures (linked lists)
5
Pointers Function arguments Relationship with arrays
Address arithmetic Strings (char pointers) Arrays of pointers; pointers to pointers char *p1[10] versus char (*p2)[10] Pointers and 2D-arrays Dynamic memory allocation Command-line arguments
6
UNIX Basic UNIX commands Shell scripting (all)
How to study: first learn the basics then … Step 1: for each example/script, describe in detail what the script does, what will be printed. Step 2: (a couple of days later) read the problem descriptions, write the scripts (without looking at the lecture notes) and make them run.
7
During the exam … No questions You will be given Table of precedence
ASCII code table UNIX reference sheets
8
Pointers and Arrays int a[10], *pa; pa = a; /* same as pa = &a[0]*/ pa++; /*same as pa = &a[1]*/ a[i] *(a+i) &a[i] a+i pa[i] *(pa+i) Notes a = pa; a++; are illegal. Think of a as a constant, not a var. p[-1], p[-2], etc. are syntactically legal. 8
9
Arrays of Pointers: Example
char *words[] = { “apple”, “cherry”, “prune” }; char **p; p = words; printf("%c\n", **p); printf("%c\n",*(*(p+1)+2)); printf("%c\n",*(*(p+2)+2)+1); +1 9
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.