Programming
Casual
360

Eror notice C:\pointer.c|19|warning: initialization makes integer from pointer without a cast [-Wint-conversion]|






  14-Nov-2020 14:58:57



||=== 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

DISCUSSION

Itu type data int yakin suda dibuat pointer ?

C:\pointer.c|19|warning: initialization makes integer from pointer without a cast [-Wint-conversion]|




Reply


14-Nov-2020 15:00:52



Yang mana bang


Reply


14-Nov-2020 15:01:23



int main() {
int a, b;
int pa = &a, *pb = &b;

Itu belum dibuat pointer

Reply


14-Nov-2020 15:03:22



Jadi var *pa = &a, *pb = &b;


Reply

Login for comment and discussion.
Login Here
Popular Posts
Gps Tracker Seccodeid Free Too...
Djie sam soe Djie sam soe
General
5058
156
Top

Complete Basic Course in Kali...
Djie sam soe Djie sam soe
Linux
4369
2
Top

Free Proxy List
Sandidi Sandidi
Networking
2772
3
Top

Mass Reverse IP Unlimited
ImamSy ImamSy
Hacking
2059
10
Top

Report McAfee Antivirus Hurrri...
Indrasp Indrasp
Windows
1558
93
Top

Related Post

Subscribe

Subscribe free now for latest posts