This feed contains pages with tag "C".

Chapter 15, multiple compilation units, include files, makefile

slides printable

Chapter 15, multiple compilation units, include files

slides printable

Chapter 17 variable sized structs. Chapter 15, multiple compilation units, include files

slides printable

Chapter 17 Dynamic memory allocation, linked lists, variable sized structs

slides printable

Chapter 17 Dynamic memory allocation, linked lists

slides printable

Fill in the three missing functions in this code, so that numbers are printed out in order. Note that you can debug print_numbers independently.

```
#include <stdio.h>
#include <stdlib.h>
struct node {
int value;
struct node *next;
};
struct node *read_numbers(void){
struct node *first = NULL;
int n;
printf("Enter a series of integers"
" (0 to terminate): ");
for (;;) {
scanf("%d", &n);
if (n == 0)
return first;
first = add_to_list(first, n);
}
}
struct node *reverse(struct node *list){
}
struct node *add_to_list(struct node *list, n){
}
void print_numbers(struct node *list){
}
int main(void){
struct node *list=NULL;
list=read_numbers();
list=reverse(list);
printf("output: \n");
print_numbers(list);
}
```

Chapter 17 Dynamic memory allocation

slides printable

Chapter 16,17 Enumerations, Pointers

slides printable

Chapter 16 Structures, Unions

slides printable

Chapter 16 Structures

slides printable

Chapter 14 Preprocessor

slides printable

Chapter 14 Preprocessor

slides printable

Chapter 13 Strings

slides printable

Chapter 13 Strings

slides printable

Chapter 13 Strings

slides printable

Chapter 12. Pointers and Arrays, Chapter 13 Strings

slides printable

## Exercises from Chapter 11,12 of King

- Given the following declarations

```
int i;
int *p,*q;
```

Which of the following assignments are legal

```
p=i;
*p=&i;
&p=q;
p=&q;
p=*&q;
p=q;
p=*q;
*p=q;
*p=*q;
```

- Write the following function

```
void find_two_largest(int a[], int n, int *largest, int *second_largest);
```

- What will be the contents of array
`a`

after the following code is executed?

```
#define N 10
int a[N] = {1,2,3,4,5,6,7,8,9,10};
int *p=a,*q=a+N-1;
while(p<q){
int temp=*p;
*p++=*q;
*q--=temp;
}
```

Chapter 12. Pointers and Arrays

slides printable

Chapter 11, Chapter 12. pointers

slides printable

Chapter 10, Organization, Chapter 11

slides printable

Chapter 10, Organization

slides printable

Chapter 9, functions

slides printable

Chapter 9, functions

slides printable

Chapter 8, Arrays

slides

Chapter 7, Type conversions

slides printable

Chapter 7, int, float, char, getchar, putchar

slides printable

Chapter 7, int, float, char, getchar, putchar

slides printable

loops, goto-like statements, comma operator. Chapter 6 in King

slides printable

Logical Expresssions,

`if`

, conditional expressionsslides printable

Expresssions. Chapter 4,5 of King.

slides printable

Expresssions. Chapter 4 of King.

slides printable

Formatted I/O, Expresssions. Chapter 3,4 of King.

slides printable

Formatted I/O, Chapter 3 of King.

slides printable

Introduction to C, Chapter 2, 3 of King.

slides printable

Introduction to C, Chapter 2 of King.

slides printable

Introduction to C, chapters 1 and 2 of King.

slides printable