title: segmentation fault pro*c code for database connection
body: <p>I wrote simple pro*c program to check database connectivity.  The code is :</p>
  
  <pre><code>int main()
  {
      char *conn_string = "IDA/IDA@DBISPSS";
      int x = 10;
      printf("value of x is before db connection %d\n",x);
      printf(" conn_string %s \n",conn_string);
      EXEC SQL CONNECT :conn_string;
      EXEC SQL SELECT 1 INTO :x FROM DUAL;
      printf("value of x is %d\n",x);
      return 0;
  }
  </code></pre>
  
  <p>Following commands I executed to create exectuable (test_connection) of pro*c code </p>
  
  <pre><code>proc test_connection.pc
  
  cc -I${ORACLE_HOME}/precomp/public -c test_connection.c
  cc   test_connection.o   -o test_connection -L$ORACLE_HOME/lib -lclntsh
  </code></pre>
  
  <p>and when I executed test_connection exe,the output is </p>
  
  <pre><code>value of x is before db connection 10
  conn_string IDA/IDA@DBISPSS
  Segmentation fault
  </code></pre>
  
  <p>But the same code workes well in another linux machine and solaris machine.</p>
  
  <p>Why segmentation fault is thrown? </p>