summaryrefslogtreecommitdiff
path: root/The_C_Book/Chapter7.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'The_C_Book/Chapter7.ipynb')
-rwxr-xr-xThe_C_Book/Chapter7.ipynb125
1 files changed, 125 insertions, 0 deletions
diff --git a/The_C_Book/Chapter7.ipynb b/The_C_Book/Chapter7.ipynb
new file mode 100755
index 00000000..07af61e0
--- /dev/null
+++ b/The_C_Book/Chapter7.ipynb
@@ -0,0 +1,125 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:64783eeed575effedf7614334dd2d387799a93300002feb4bfabb494331b571e"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 7: The Preprocessor "
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7.1, page no. 215\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "def DOUBLE(x):\n",
+ " return x+x\n",
+ "\n",
+ "print \"%d\\n\" %(DOUBLE(1))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7.2, page no. 217"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "def TEST(x):\n",
+ " if(not (x)):\n",
+ " print \"test failed.... \"\n",
+ " else:\n",
+ " print \"Test passed...\"\n",
+ "\n",
+ "TEST(23)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Test passed...\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7.3, page no. 220"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "ULONG_MAX = 4294967295 # MAX LIMIT OF LONG IN C LANG.\n",
+ "if ULONG_MAX+1 != 0:\n",
+ " print \"Preprocessor: ULONG_MAX+1 != 0\\n\"\n",
+ "if ULONG_MAX+1 != 0:\n",
+ " print \"Runtime: ULONG_MAX+1 != 0\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Preprocessor: ULONG_MAX+1 != 0\n",
+ "\n",
+ "Runtime: ULONG_MAX+1 != 0\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file