#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <sys/time.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
void* findSin(void *arrayTwoD)
{
float **myArray = ((float **)arrayTwoD);
float total = 0.0;
int x = 0;
float *radAngle;
for (int data = 0; data < 2; data++)
{
*radAngle = *(*(myArray + data) + 0); <---This is triggering the error
for (int i = 1; i < 15; i += 2)
{
total += pow(*radAngle, i) / findFactorial(i);
}
printf("\nSin %f is %f \n", *myArray[data], total);
}
pthread_exit(0);
}
int main()
{
pthread_t threadid1;
float angleDegree;
float angleRadian;
float myArray[2][2];
for (int i = 0; i < 2; i++)
{
printf("Please enter the angle in degree: ");
scanf("%f", &angleDegree);
angleRadian = (angleDegree / 180.0) * M_PI;
myArray[i][0] = angleRadian;
}
pthread_create(&threadid1, NULL, findSin, (void *)myArray);
pthread_join(threadid1, NULL);
}
**Please help me, i'm stuck trying to figure out how to correctly access the elements.Thanks.
Situation: The first column of the 2d array contains angles entered by the user. The function findSin uses the first column to find the sin value of the related element. I'm not able to access the element of the first column**
ERROR: Segmentation fault (core dumped)