Error pointer -Wint-Conversion ?? Int to int *

Asked

Viewed 73 times

-1

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


 int *a;
 int  b;


int main()
{
  
 b = 5;

*a = &b;

printf("%x \n",a);
printf("%d",*a);

printf("\n %d",b);

return 0;
}

In code output this error appears :

ponteiros.c: In function ‘main’:
ponteiros.c:13:8: warning: assignment to ‘int’ from ‘int *’ makes integer from pointer without a cast [-Wint-conversion]
     *a = &b;
  • Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful to you. You can also vote on any question or answer you find useful on the entire site.

1 answer

1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.