converting rows into columns

That was my first comment! One column is a trivial, edge case. This C solution is valid, general, robust and can even do this little task.

If the title brings the needy here, this bit of code had been very good to me. I particularly found the conversion of "many rows of many columns" into "a column of header and one or few columns of data" to be very useful for inspection of bulky matrices. If you know the lines per row, you can jump up and down to see the same column in different rows, or search on the column name. You can take the data out of Excel or SQL and flip it around before putting in on paper or into Excel. Since Excel used to have a 255 column & 4096 row limit, wider rows could be rotated for inspection.