My goal is a function that returns the same text as I wrote in stdin. As a result of compilation of the code below:
#include <stdio.h>
char chain[990];
int znaki()
{
scanf("%s", chain);
int i=0;
do{
putchar(chain[i]);
i++;
}
while(chain[i]!=10);
return 0;
}
int main(int argc, char **argv)
{
znaki();
return 0;
}
I get:
MyOwnText
MyOwnText
and
many
lines
of some random text just like cat /dev/random in linux
The first line is my input. Why?
It's pretty obvious to me why the input you wrote was printed out.