100 Most Important C# Programs
82. Program to accept a string using pointers and functions.
Code:
#include<stdio.h>
#include<conio.h>
main( )
{
int ch[20];
clrscr ( );
printf(“enter a string”);
read_array(ch);
printf(“%s”,ch);
getch( );
}
void read_string (char*pt)
{
for(;(*pt=getchar( ))!=’/n’;pt++);
*pt=’\0’;
}