C Program To Find Initials of a Name Last Updated : 04 Jul, 2022 Comments Improve Suggest changes Like Article Like Report Here, we will see how to find the initials of a name using a C program. Below are the examples: Input: Geeks for GeeksOutput: G F GWe take the first letter of allwords and print in capital letter. Input: Jude LawOutput: J L Approach: Print the first character in the capital. Traverse the rest of the string and print every character after space in capital letters. Below is the C program to print the initials of a name: C // C program to print initials // of a name # include <stdio.h> # include <string.h> # include <ctype.h> // Function declaration void getInitials(char* name); // Driver code int main(void) { // Declare an character array for // entering names assuming the // name doesn't exceed 31 characters char name[50] = "Geeks for Geeks"; printf("Your initials are: "); // getInitials function prints // the initials of the given name getInitials(name); } void getInitials(char* name) { int i = 0; if(strlen(name) > 0 && isalpha(name[0])) printf("%c ", toupper(name[0])); while(name[i] != '\0') { if(isspace(name[i]) != 0) { while(isspace(name[i]) && i <= strlen(name)) { i++ ; } printf("%c ", toupper(name[i])); } i++; } printf("\n"); } OutputYour initials are: G F G Time Complexity: O(n), where n is the length of the string. Auxiliary Space: O(1), as constant extra space is used. Create Quiz C Program to Find the Initials of a Name Comment O okaysaoyw Follow 0 Improve O okaysaoyw Follow 0 Improve Article Tags : C Programs C Language Explore C BasicsC Language Introduction6 min readIdentifiers in C3 min readKeywords in C2 min readVariables in C4 min readData Types in C3 min readOperators in C8 min readDecision Making in C (if , if..else, Nested if, if-else-if )7 min readLoops in C6 min readFunctions in C5 min readArrays & StringsArrays in C4 min readStrings in C5 min readPointers and StructuresPointers in C7 min readFunction Pointer in C5 min readUnions in C3 min readEnumeration (or enum) in C5 min readStructure Member Alignment, Padding and Data Packing8 min readMemory ManagementMemory Layout of C Programs5 min readDynamic Memory Allocation in C7 min readWhat is Memory Leak? How can we avoid?2 min readFile & Error HandlingFile Handling in C11 min readRead/Write Structure From/to a File in C3 min readError Handling in C8 min readUsing goto for Exception Handling in C4 min readError Handling During File Operations in C5 min readAdvanced ConceptsVariadic Functions in C5 min readSignals in C language5 min readSocket Programming in C8 min read_Generics Keyword in C3 min readMultithreading in C9 min read Like