~ubuntu-branches/ubuntu/trusty/pyrex/trusty-proposed

« back to all changes in this revision

Viewing changes to Demos/callback/cheesefinder.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2006-01-03 20:56:08 UTC
  • mto: (2.1.3 dapper) (4.1.1 lenny) (1.1.7 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20060103205608-4i29xv9avi33du20
Tags: upstream-0.9.3.1
ImportĀ upstreamĀ versionĀ 0.9.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *   An example of a C API that provides a callback mechanism.
3
 
 */
4
 
 
5
 
#include "cheesefinder.h"
6
 
 
7
 
static char *cheeses[] = {
8
 
  "cheddar",
9
 
  "camembert",
10
 
  "that runny one",
11
 
  0
12
 
};
13
 
 
14
 
void find_cheeses(cheesefunc user_func, void *user_data) {
15
 
  char **p = cheeses;
16
 
  while (*p) {
17
 
    user_func(*p, user_data);
18
 
    ++p;
19
 
  }
20
 
}
21