warning: assignment from incompatible pointer-Typ [standardmäßig aktiviert]

#include <math.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
   double x,y;
   printf("Enter a double: ");
   scanf("%lf", &x);
   printf("Enter another double:");
   scanf("%lf", &y);
   int *ptr_one;
   int *ptr_two;
   ptr_one = &x;
   ptr_two = &x;
   int *ptr_three;
   ptr_three = &y;
   printf("The Address of ptr_one: %p \n", ptr_one);
   printf("The Address of ptr_two: %p \n", ptr_two);
   printf("The Address of ptr_three: %p", ptr_three);

return 0;
}

Das problem ist, jedes mal, wenn ich versuchen, zu senden dieser code diese Meldung:

Zuweisung von inkompatiblen Zeigertyp [standardmäßig aktiviert]

Ich dachte, die math.h könnte es beheben, aber negativ. Bitte brauche Hilfe es zu beheben

  • GCC-compiler gibt ausreichende Informationen über die Warnung. 4.c:14:12: warning: incompatible pointer types assigning to 'int *' from 'double *' [-Wincompatible-pointer-types] ptr_one = &x;
InformationsquelleAutor question | 2015-09-19
Schreibe einen Kommentar