Mega Code Archive

 
Categories / C / Console
 

Get string from console and assign it to a char pointer

#include <stdio.h> int main(void) {   char *p, str[80];   printf("Enter a string: ");   p = gets(str);   if(p) /* if not null */     printf("%s %s", p, str);   return 0; }