Completely Solved C, C++ Programs Assignment.




C Program to accept a string using pointers and functions

Filed Under:

Problem 82. C Program to accept a string using pointers and functions.
#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=’�’;
}

C compiler: gcc 4.1.2

 Back to main directory: Sample C Program | Software Practical | Solved C Assignment


Get Free Programming Tutorials and Solved assignments