My name is c
#include <stdio.h>
int main() {
char name[] = "c";
printf("My name is %s.\n", name);
return 0;
}
Explanation:
#include <stdio.h>
: Includes the standard input-output library in the C program to use functions likeprintf()
.int main() { ... }
: Defines the main function, the entry point of the program where execution begins.int
specifies the return type of the function, andmain()
is the function name. The curly braces{}
mark the beginning and end of the main function's body.char name[] = "c";
: Declares a character array namedname
and initializes it with the string "c", which is the name assigned.printf("My name is %s.\n", name);
: Displays the formatted output to the console.%s
is a format specifier used for strings. The value of thename
array is printed in place of%s
.\n
represents a newline character, which moves the cursor to the next line after printing.return 0;
: Indicates the end of themain()
function. It returns an integer value0
to the operating system, signifying successful execution of the program.