Permalink
Browse files

SWIG example for lecture

  • Loading branch information...
1 parent 24c232a commit 24dea7de8ec8a24cb4e244df01fd10157d807144 Luís Pedro Coelho committed Apr 27, 2009
@@ -0,0 +1,9 @@
+int countchar(const char* str, char ch) {
+ int res = 0;
+ while (*str) {
+ if (*str == ch) ++res;
+ ++str;
+ }
+ return res;
+}
+
@@ -0,0 +1,3 @@
+%module countchar
+extern int countchar(const char* str, char ch);
+

0 comments on commit 24dea7d

Please sign in to comment.