||=== Build file: "no target" in "no project" (compiler: unknown) ===|
C:\pointer.c||In function 'main':|
C:\pointer.c|19|warning: initialization makes integer from pointer without a cast [-Wint-conversion]|
C:\pointer.c|23|warning: passing argument 1 of 'update' makes pointer from integer without a cast [-Wint-conversion]|
C:\pointer.c|3|note: expected 'int *' but argument is of type 'int'|
||=== Build finished: 0 error(s), 2 warning(s) (0 minute(s), 2 second(s)) ===|
Code
#include <stdio.h>
void update(int *a,int *b) {
int a1 = *a + *b;
int b1 = *a - *b;
*a = a1;
if(b1<=0)
{
*b = -b1;
}
else
{
*b = b1;
}
}
int main() {
int a, b;
int pa = &a, *pb = &b;
printf("Masukan angka\n");
scanf("%d %d", &a, &b);
update(pa, pb);
printf("%d\n%d", a, b);
return 0;
}
Program jalan tpi kok ada notice eror?di line 19 merah salah dmn
*Beware click the link!
Freelance | Student
Itu type data int yakin suda dibuat pointer ?
C:\pointer.c|19|warning: initialization makes integer from pointer without a cast [-Wint-conversion]|
Reply
Yang mana bang
Reply
Reply
Jadi var *pa = &a, *pb = &b;
Reply
Fix makasih
Reply
Sama - sama
Baca ini : https://www.codeproject.com/Questions/1266041/My-C-program-returns-error-Warning-initialization
Reply