CSC 270 - Survey of Programming Languages

Assignment #4a - A very basic string program in C

Due Monday, September 18, 2017

Write a program that prompts the user for a line of text, prints it and repeats this until the user types "The end".

You may use getchar, scanf or fgets, as shown in the example:


#define	lengthOfs	50

int	main(void)	{
	int	c;
	char	s[lengthOfs];

	c = getchar();
	scanf("%s", &s);
	fgets(s, lengthOfs - 1, stdin);
}

[Back to the Assignments List]