65.6k views
4 votes
Write a C Program to Print the initial letter of Name Ferdous

User Trippedout
by
5.2k points

1 Answer

8 votes

Answer:

The answer to this question is given below in the explanation section.

Step-by-step explanation:

The question is about writing a C program that prints the initial letter of Name Ferdous.

Therefore, below is the given complete code that prints the first letter of the name Ferdous.

#include <stdio.h> /*import strandard input/output library*/

#include<string.h> /*import string library to handle string type of data*/

int main(void) /*started the program execution- program entry point*/

{

char *str = "Firdous"; /*char to pointer str contains string "Firdous"*/

int len = strlen(str); /*this line of code is not neccary, but if you print other character for example last character of the name then you can use it*/

printf("First Letter of the name is: %c", str[0]); /*print first letter of the name*/

} /**program terminated*/

User Clarita
by
5.8k points