Untitled
unknown
plain_text
2 years ago
506 B
12
Indexable
#include <stdio.h>
#include <unistd.h>
int main(void)
{
/*Buffer whose address will be passed as argument to getline()*/
char *buffer;
size_t n;
ssize_t bytes_read;
n = 0;
buffer = NULL;
/*printing the prompt for the user to enter something*/
printf("$ ");
bytes_read = getline(&buffer, &n, stdin);
if (bytes_read == -1)
perror("Error");
printf("%s", buffer);
return (0);
}Editor is loading...
Leave a Comment