Hey i got the same error in my code and as discussed i cant rectify it after changing the u value. The error is on a linux machine. The program checks if a no is prime or not.

#include<stdio.h>
int primality(int n)
{
        int i;
        char ch='y';
        for(i=2;i<n;i++)
        {
                if(n%i==0)
                        ch='n';
        }
        printf("%s",ch);  
        return 0;
}
int main()
{
        int u=10;
        primality(u);
        return 0;
}
jephthah commented: a 5 year old thread? really? who knew? -1
jonsca commented: Don't bump old threads! -1
Salem commented: me too -4

you can't print an int (or char) as a string ("%s")

in the future, don't bump 5 year old threads. start your own. and use [code] tags.

thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.