external variables are not working...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hemant0328
    New Member
    • Aug 2014
    • 1

    external variables are not working...

    Code:
    #includ<stdio.h>
    int x,y;
    void eqn(int a,int b)
    {
    x=a+b;
    y=a-b;
    }
    main()
    {
    int t,r,p,q;
    scanf("%i%i");
    eqn(t,r);
    p=x;
    q=y;
    printf("%i,%i",p,q);
    }
    Last edited by Rabbit; Aug 18 '14, 03:41 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • horace1
    Recognized Expert Top Contributor
    • Nov 2006
    • 1510

    #2
    should the scanf statement be
    Code:
    scanf("%i%i", &t, &r);
    also you have miss spelt #include

    Comment

    Working...