summaryrefslogtreecommitdiff
path: root/Practical_C_Programming_by_Steve_Oualline/Chapter_12_1.ipynb
diff options
context:
space:
mode:
authorkinitrupti2017-05-12 18:53:46 +0530
committerkinitrupti2017-05-12 18:53:46 +0530
commitf270f72badd9c61d48f290c3396004802841b9df (patch)
treebc8ba99d85644c62716ce397fe60177095b303db /Practical_C_Programming_by_Steve_Oualline/Chapter_12_1.ipynb
parent64d949698432e05f2a372d9edc859c5b9df1f438 (diff)
downloadPython-Textbook-Companions-f270f72badd9c61d48f290c3396004802841b9df.tar.gz
Python-Textbook-Companions-f270f72badd9c61d48f290c3396004802841b9df.tar.bz2
Python-Textbook-Companions-f270f72badd9c61d48f290c3396004802841b9df.zip
Removed duplicates
Diffstat (limited to 'Practical_C_Programming_by_Steve_Oualline/Chapter_12_1.ipynb')
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_12_1.ipynb60
1 files changed, 60 insertions, 0 deletions
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_12_1.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_12_1.ipynb
new file mode 100755
index 00000000..090a4ee1
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_12_1.ipynb
@@ -0,0 +1,60 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:184261c50791da479b656a01719125426370a323ab51da034b4dc57d574572c3"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 12: Advanced types"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 12.1, Page number: 212"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Union declaration\n",
+ "from ctypes import *\n",
+ "class value (Union) :\n",
+ " _fields_ = [(\"i_value\", c_int),\n",
+ " (\"f_value\", c_float)]\n",
+ "\n",
+ "# Calculation and result\n",
+ "data = value (3, 5.0)\n",
+ "print (data.i_value, data.f_value)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(1084227584, 5.0)\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file