#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    26
    Rep Power
    0

    Help With Pointers.


    I am trying to make a .txt to save to the disk from 2 entered numbers its using a function. It Gives me an error that say: warning assignment makes pointer from integer without a cast
    The error says its on line 8 . The program Compiles and runs but crashes right after a enter the two numbers. Any help will be appreciated. Source code is at the bottom.



    #include <stdio.h>

    int s,a,b,c;

    int Save(int s1, int s2)
    {
    FILE *s;
    s = b;
    a = c;

    s = fopen("High.dat","w");
    if(s==NULL)
    {
    puts("Error Creating File\n");
    return 1;

    }
    fprintf(s,"%d %d",s,a);
    fclose(s);
    puts("Numbers Saved To Disk");

    }

    int main()
    {
    printf("Enter 2 Numbers\n");
    scanf("%d,%d",b,c);

    Save(b,c);
    return 0;
    }
    Last edited by CAAA; April 27th, 2013 at 09:34 PM. Reason: Misspelled Some Words
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    26
    Rep Power
    0
    Never mind just had to change FILE *s to FILE *scores

IMN logo majestic logo threadwatch logo seochat tools logo