trying to learn C i got stuck with this: I'm trying to write a function squared which should print on screen a filled square with size and filling character choosen by the user. So i wrote this:
#include <stdio.h>
int squared (int side, char fillCharacter);
int main(){
int side;
char fillCharacter;
printf("Enter the side ");
scanf("%d", &side);
printf("Enter the character ");
scanf("%c", &fillCharacter);
printf("%d%c",squared(side, fillCharacter));
}
int squared (int side, char fillCharacter){
for (int row=1 ; row <= side; row++){
for (int i =1; i <= side; i++){
printf("%c", fillCharacter);
}
puts("");
}
}
But sadly the output of this doesn't even scan for the character and just print a blank space
Enter the side 2
Enter the character
I tried change things but i made it worse so if someone could give me a hint i really would appreciate it. Thanks.