title: How to pass a string inside a function in python which is exported from cpp using the library ctypes
body: <p>cpp code snippet where i am exporting the function <code>encrypt</code> which takes argument like below</p>
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  string Function(char* str) 
  {
      
      string temp = str;
      int length = temp.length();
      
      int disp = length,i=0;
      char printChar;
      
      char *store = (char *)malloc(sizeof(char)*100);
      while(disp &gt; 0) {
          printChar = *(str + length - disp);
          if ((printChar &gt;= 65) &amp;&amp; (printChar &lt;= 90)) {
              if (printChar+disp &gt; 90) {
                  printChar = ((printChar+disp) % 90) + 64;
                  store[i] = printChar;
                  
              }else{
                  printChar += disp;
                  store[i] = printChar;
                  
              };
          }
          else if ((printChar &gt;= 97) &amp;&amp; (printChar &lt;= 122)) {
              if (printChar+disp &gt; 122) {
                  printChar = ((printChar+disp) % 122) + 96;
                  store[i] = printChar;
                  
              }else{
                  printChar += disp;
                  store[i] = printChar;
                    
              };
          }
          else {
              store[i] = printChar;
              
          };
          disp -= 1;
          i += 1;
      };
      return store;
  }
  // The part where i am exporting
  extern &quot;C&quot; {
      string encrypt(char* str) // this is the functionName(in this case encrypt) which i am giving when exporting
      {
          return Function(str);
      }
  }
  </code></pre>
  <p>What should be my python code to pass a string in this exported function somewhat like:</p>
  <pre><code>userString = input()
  result = encrypt(userstring) // this is function created in cpp
  print(result)
  </code></pre>
  <p>I don't know how to use ctypes properly. So please can someone help with this question?</p>