Beginner · C PROGRAMMING

Your first C program

What you will learn

Understand source code, main and standard output.

Understand the concept

A C compiler translates source into an executable. The stdio.h header declares input and output functions. Execution begins in main. puts writes a string followed by a newline. Returning zero reports successful termination.

Read the example

The complete program appears below. Read it first, predict the output, then run it.

Expected output

Hello, TCS Pune!

Practise

Change the greeting and add another puts call that prints your learning goal.

Common mistake

Statements need semicolons. Keep the header name inside angle brackets; use straight quotation marks around strings.

Lesson discussion

Log in to participate.

#include <stdio.h>

int main(void) {
    puts("Hello, TCS Pune!");
    return 0;
}
PRACTICE LAB

Read. Edit. Run.

C source · .c

Experiment with the program below. Your code and input are sent to the selected compiler only when you run it.

Tab indents · Shift+Tab unindents · Esc then Tab leaves the editor · Ctrl/Cmd+Enter runs · Ctrl/Cmd+S saves a draft

Changes save automatically to your account.

Input / output example

Example input
No input required.
Expected output for the original program
Hello, TCS Pune!
Output will appear here.

Log in to save your progress

Ready when you are

Need help with your laptop or computer?

Send us the model and fault details. Start your repair request online or contact TCS Pune directly.

WA