summaryrefslogtreecommitdiff
path: root/Beginning_C_By_Ivon_Horton/chapter7.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Beginning_C_By_Ivon_Horton/chapter7.ipynb')
-rw-r--r--Beginning_C_By_Ivon_Horton/chapter7.ipynb65
1 files changed, 16 insertions, 49 deletions
diff --git a/Beginning_C_By_Ivon_Horton/chapter7.ipynb b/Beginning_C_By_Ivon_Horton/chapter7.ipynb
index 7a7e0247..e46960ce 100644
--- a/Beginning_C_By_Ivon_Horton/chapter7.ipynb
+++ b/Beginning_C_By_Ivon_Horton/chapter7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:711ef8d09307cb9b16d63b16134924968e61ecb1c05fd7745b7d89ba9bc4ac32"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,10 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "A simple program using pointers\n",
- "note: there are no pointers in Python.\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import sys\n",
"\n",
@@ -74,9 +72,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "What's the pointer of it all\n",
- "\"\"\"\n",
+ "\n",
"\n",
"num1 = 0\n",
"num2 = 0\n",
@@ -115,10 +111,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Using pointer arguments to scanf_s\n",
- "note: in Python you cannot use pointers to input a value\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Input an integer: \",\n",
"value = int(raw_input())\n",
@@ -164,9 +157,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Arrays and pointers\n",
- "\"\"\"\n",
+ "\n",
"\n",
"multiple = ['M', 'y','s','t', 'r', 'i', 'n', 'g']\n",
" \n",
@@ -201,9 +192,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Incrementing a pointer to an array\n",
- "\"\"\"\n",
"\n",
"multiple = \"a string\"\n",
"p = multiple\n",
@@ -243,9 +231,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Incrementing a pointer to an array of integers\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import sys\n",
"\n",
@@ -286,9 +272,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Two-dimensional arrays and pointers\n",
- "\"\"\"\n",
+ "\n",
"\n",
"board = [['1','2','3'],\n",
" ['4','5','6'],\n",
@@ -324,9 +308,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Two-dimensional arrays and pointers\n",
- "\"\"\"\n",
+ "\n",
"\n",
"board = [['1','2','3'],\n",
" ['4','5','6'],\n",
@@ -363,9 +345,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Getting values in a two-dimensional array\n",
- "\"\"\"\n",
+ "\n",
"\n",
"board = [['1','2','3'],\n",
" ['4','5','6'],\n",
@@ -408,9 +388,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Multidimensional arrays and pointers\n",
- "\"\"\"\n",
+ "\n",
"\n",
"board = [['1','2','3'],\n",
" ['4','5','6'],\n",
@@ -453,9 +431,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Understand pointers to your hat size - if you dare\n",
- "\"\"\"\n",
+ "\n",
"\n",
"size = [['6', '6', '6', '6', '7', '7', '7', '7', '7', '7', '7', '7'],\n",
" ['1', '5', '3', '7', ' ', '1', '1', '3', '1', '5', '3', '7'],\n",
@@ -521,10 +497,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "A dynamic prime example\n",
- "note: program 7.12 will remain same\n",
- "\"\"\"\n",
+ "\n",
"\n",
"pPrimes = []\n",
"found = False\n",
@@ -600,9 +573,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Extending dynamically allocated memory for strings\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import sys\n",
"\n",
@@ -681,9 +652,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Using array notation with pointers to sort strings\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter strings to be sorted, separated by '.' Press Enter to end: \"\n",
"text = raw_input()\n",
@@ -741,9 +710,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "An improved calculator\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"To use this calculator, enter any expression with or without spaces.\"\n",
"print \"An expression may include the operators\"\n",