I've started learning C this week and I have a problem. I'm trying to let the user enter how many inputs he wants , but the loop will stop when he enter the input -1 . I'm getting the Operand types are incompatible ("float *" and "const char *") error.
#include <stdio.h>
#include <stdlib.h>
void average()
{
int i;
float num[100];
float sum = 0;
float average = 0;
int n = sizeof(num)/sizeof(num[0]);
//printf("Enter the size of the array: \n");
//scanf("%d" , &n );
for (i=0 ; i<n ; i++)
{
printf("%d. Enter number: ",i+1);
scanf("%f",&num[i]);
sum+=num[i];
if (num == "-1")
{
break;
}
}
average=sum/n;
printf("Average = %.2f",average);
}