Skip to content
Solved Examples · Example 35

Q.Give a sample C program that prints the message "Welcome to PUC" (illustrating the basic structure of a C program with a standard library function). The textbook presents this worked program, transcribed exactly as printed (including its printed errors):
#include<stdio.h>  
void main()  
{  
    printf("Welcome to PUC\n");  
}  
Sample output printed in the textbook:
Welcome to PUC  

Karnataka PUCTextbookLongImportance★★★★★est
97% · 149/154 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

[!TLDR]

The smallest useful C program: main() with one printf() prints "Welcome to PUC".

Every C program begins execution at main(). The line #include<stdio.h> brings in the declaration of the standard library function printf(), which is a ready-made (standard) function that writes text to the screen; the \n at the end moves the cursor to the next line. This example is used to introduce the idea of C functions - standard library functions such as printf(), sqr …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.