r/shittyprogramming • • Nov 20 '18

How to Capitalize a String

word.ToCharArray()[0] = word.ToCharArray()[0].ToString().ToUpper().ToCharArray()[0];

69 Upvotes

37 comments sorted by

View all comments

Show parent comment

4

u/enp2s0 Nov 21 '18

It could be a pointer, like

malloc(23 * sizeof(char))[0] = 'h';

This is really shitty code because you lose the address and can't free it, but it works.