knr

Does this small C program satisfy the K&R question?

This is not homework. I'm just trying to learn :) I'm on to K&R's Exercise 1-18 Write a program to remove trailing blanks and tabs from each line of input, and to delete entirely blank lines. This is what I've came up with so far #include <stdio.h> #define MAXLINE 1000 int getline(char line[], int maxline); void copy(char to[],...

Want to Join K&R Study Group?

Hello All, Someday I want to be a computer scientist. Right now I'm looking for a few good men, women, girls, boys, cats, dogs, fish ... anybody ... anybody? I've completed all the exercises in Chapter 1 of Kernighan & Ritchie's "The C Programming Language - ANSI C" (more or less independently) and wish to work through the rest of the ...

C : Dynamically storing strings (of dynamic sizes!)?

Am I missing something incredibly simple? because I can't seem to find a reason why my code isn't storing strings dynamically. All I get are blank lines when I print them at the end. Its supposed to print the last "n" lines of an arbitrary number of lines. There seems to be a problem with the storage of the actual lines though. Can anyon...