Skip to content

Instantly share code, notes, and snippets.

@sqlbyme
Forked from satipants/CS50 Initials
Last active July 13, 2016 23:43
Show Gist options
  • Save sqlbyme/339ae1cb2a95c4af708bf177cf60ef25 to your computer and use it in GitHub Desktop.
Save sqlbyme/339ae1cb2a95c4af708bf177cf60ef25 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <cs50.h>
#include <ctype.h>
#include <string.h>
int main(void) {
/* FIXME: I think this is in the worng location.
* Ask Beanz but I think this needs to be between lines 13 & 14. */
string name = GetString();
if (name != NULL) {
printf("It is I, the great ABREVIATOR! If you tell me your name, I'll provide your initials!\n");
printf( "%c", toupper(name[0]));
for (int i = 0, n = strlen(name); i < n; i++)
{
if (name[i])== ' ') {
printf('%c', toupper(name[i+1]) );
}
}
/* FIXME: What is this break statement for? */
break;
}
/* We need to return an integer value becuse
* that is how we defined our function. */
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment