#include<stdio.h>
#include<stdlib.h>
#include<string.h>
char slovo(char *x);
int main ()
{
char x;
x=(char *)malloc(50*sizeof(char));
fgets(x,sizeof(x),stdin);
printf("%s",slovo(x));
return 0;
}
char slovo(char *x)
{
int i,n;
n=strlen(x);
for(i=0;i<n;i++)
{
if ((x[i]>='A' && x[i]<='Z') || (x[i]>='a' && x[i]<='z')) x[i]=x[i];
else x[i]= ('A'+(rand()%26) || ('a'+(rand()%26)));
}
return x;
}
The task is to enter a string with a max of 50 characters and also allocate the memory for 50 characters. If a character in the string isnt a letter I must randomly convert it to any letter. I have a lot of errors and I dont know what to do.
8 3 C:\Users\x\Documents\juarsr.c [Warning] assignment makes integer from pointer without a cast
9 8 C:\Users\x\Documents\juarsr.c [Warning] passing argument 1 of 'fgets' makes pointer from integer without a cast
10 20 C:\Users\x\Documents\juarsr.c [Warning] passing argument 1 of 'slovo' makes pointer from integer without a cast
4 6 C:\Users\x\Documents\juarsr.c [Note] expected 'char ' but argument is of type 'char'
24 2 C:\Users\x\Documents\juarsr.c [Warning] return makes integer from pointer without a cast