Quote Originally Posted by timhxf
I have written a piece of code to a character and display it a number of times defined by the user, but I got error seems in the scanf statement, can somebody help me? thanks
Code:
#include<stdio.h>
void chline(char z,int x,int y);
int main(void)
{
    int x,y;
    char z;
    printf("ple enter number");
    scanf("%c %d %d",&z,&x,&y);
    chline(z,x,y);
    system("pause");
    return 0;
}
void chline(char z,int x,int y)
{
       while(x<=y)
       {
       printf("%c ",z);
       x++;
                  }
}
You haven't declared character variable z and you haven't passed the address of that variable as a parameter to scanf(). Otherwise it's OK, but the prompt isn't very helpful to the user about what it is they have to enter.