Its okay ?

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main() {

int i,n;
char * buffer;

printf ("Jak dlugi ma byc lancuch?\n");
scanf ("%d", &i);

buffer = (char*) malloc (i+1);
if (buffer==NULL) exit (1);


for (n=0; n<i; n++)
buffer[n]=rand()%26+'a';
buffer[i]='\0';

printf ("Losowy string: %s\n",buffer);

strrev (buffer);
printf("Odwrocony string: %s\n",buffer);


system("pause");
return 0;


}



Do you have any reason to think one way or the other? Have you tried compiling and running it?
@gemsped napisz jaki masz problem z tym programem
Registered users can post here. Sign in or register to post.