Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

return a tuple c++ python 3

# C++ CODE
void divide_modulo(int a, int b, int *div, int *rest)
{
    *div  = a / b;
    *rest = a % b;
}

# COMPILE WITH
gcc -o libexample.so -shared example.c
# OR C++
g++ -o libfoo.so -shared example.cpp

# PYTHON 3.7 CODE
import ctypes
lib = ctypes.cdll.LoadLibrary('./libexample.so')

def divide_modulo(a, b):
  div = ctypes.c_int(0)
  rest = ctypes.c_int(0)
  lib.divide_modulo(a, b, ctypes.byref(div), ctypes.byref(rest))
  return (div.value, rest.value)

print(divide_modulo(11, 4))
Comment

PREVIOUS NEXT
Code Example
Python :: roganrola 
Python :: python selenium not returning correct source 
Python :: send operator by parameter python 
Python :: how to format a matrix to align all rows python 
Python :: shorter Max fonction code in python 
Python :: pandas isolate data lower than a certain percentage 
Python :: Faster way to find list of unique elements in a list 
Python :: Separating a relational plot based on a sixth variable | seaborn relational plot 
Python :: zen of python source code 
Python :: fibonacci sequence algorithm python 
Python :: python fibonacci sequence code 
Python :: make my own rabbit bomb using python 
Python :: differentate derivative differentation 
Python :: parsing a file and adding a number at starting of every line sentence python 
Python :: polycarp and coins codeforces solution 
Python :: sql o que é 
Python :: how do i add new items to a dictionary within a for loop python 
Python :: mechanize python #10 
Python :: how to add an symbol to a certain part of a list python 
Python :: create list 
Python :: convert a python object like dict, list, etc to a json object 
Python :: python concat list multiple times 
Python :: Convert Letters to Numbers in Python Using list comprehension 
Python :: load shapefile fiona multiline intersection 
Python :: unittest run one test 
Python :: BIDS extract JSON data 
Python :: Example of Python Strings with indexing 
Python :: copy string x times python 
Python :: how to move mouse by detected face and eye using opencv 
Python :: counter and element of list for loop python 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =