Duly noted. But actually my assignment was to replace the null terminator with a newline, the K&R question was a standard of how reversal should be handled.
Type: Posts; User: Jeet
Duly noted. But actually my assignment was to replace the null terminator with a newline, the K&R question was a standard of how reversal should be handled.
You are correct, however not null terminating was my choice not K&R's style.
You should take a look here : Switch Case in C and C++ - Cprogramming.com
Also make use of functions, refactor your code.
My getline() is the bare minimum version as described in the first chapter. It's not the more advanced implementation.
Works perfectly ! Now I get it ! It was the getchar() that ate my last character. Thanks for clearing it out ! I can't use fgets as it is not yet introduced in the text. Thanks for the help :) .
Made two functions and almost solved the problem but there's a small snag. One of my inputs token gets skipped ! Why is it behaving like that?
#include <stdio.h>#include <stdlib.h>
#define...
Well I was solving the K&R problem - Write a function reverse(s) that reverses the character string s . Use it to write a program that reverses its input a line at a time. I got the first part...