How to use gets() function to get (input) a string from stdin in C

1 Answer

0 votes
#include <stdio.h>
   
int main(void)
{
	char str[64];
	printf("Write some text: ");
	gets(str);
	printf("Your text is: %s\n", str);
	
    return 0;
}
  
/*
run:
  
Write some text: a b c letters
Your text is: a b c letters

*/

 



answered May 5, 2016 by avibootz

Related questions

1 answer 157 views
1 answer 201 views
1 answer 155 views
155 views asked Apr 15, 2023 by avibootz
1 answer 185 views
185 views asked Oct 20, 2022 by avibootz
1 answer 158 views
1 answer 175 views
...