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

    Join Date
    Aug 2013
    Posts
    15
    Rep Power
    0

    Please help me find the error


    #include<stdio.h>

    main()
    {
    int a=5;
    if(a==5)
    {
    puts(a);
    }
    }

    the program was written in LINUX. it is giving a compilation error.
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Location
    India
    Posts
    95
    Rep Power
    4
    argument of puts is string(char *) and you are passing int thats why it give error.
    use printf to print a.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    15
    Rep Power
    0
    Originally Posted by eramit2010
    argument of puts is string(char *) and you are passing int thats why it give error.
    use printf to print a.
    when i used printf .. its again giving a compilation error saying
    passing argument 1 of ‘printf’ makes pointer from integer without a cast.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    15
    Rep Power
    0
    Originally Posted by akha
    when i used printf .. its again giving a compilation error saying
    passing argument 1 of ‘printf’ makes pointer from integer without a cast.
    found the ERROR .. thanks :D
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Location
    India
    Posts
    95
    Rep Power
    4
    ok.
    i think u were passing a directly in printf. right?

IMN logo majestic logo threadwatch logo seochat tools logo