C Program to Find the Frequency of Characters in a String
Counts frequency of a given char.
'l' occurs 3 times
Key takeaway: Practice C programming with 71+ runnable code examples covering I/O, loops, arrays, pointers, strings, recursion, and data structures — all with expected output to verify your understanding.
Begin with printing, swapping, sizes, character checks, and simple control flow. These concise programs build confidence with C syntax and the standard library.
Last updated: August 2026
Try Online C CompilerCounts frequency of a given char.
'l' occurs 3 times
Prints a greeting to the console.
Hello, World!
Demonstrates integer I/O.
You entered: 123
Adds two integers and prints the sum.
Sum = 8
Multiplies two floats.
Product = 10.00
Prints ASCII of a character.
ASCII of A = 65
Integer division and modulo.
Quotient = 6 Remainder = 2
Uses sizeof operator.
sizeof(char) = 1 sizeof(int) = 4 sizeof(float) = 4 sizeof(double) = 8
Shows long type usage.
long x = 1234567890
Swaps using temp variable.
a = 4, b = 3
Checks parity using modulo.
7 is odd
Checks vowel set.
e is vowel
Finds max of three.
Largest = 17
Quadratic formula for ax^2+bx+c.
Roots: 2.00, 1.00
Checks leap year rules.
2024 is leap year
Checks sign.
-10 is negative
Uses isalpha.
# is not alphabet
Iterates ASCII letters.
ABCDEFGHIJKLMNOPQRSTUVWXYZ
Computes population std dev.
StdDev = 2.00
Cyclic swap a->b->c.
a=3 b=1 c=2
Uses malloc for array.
Largest = 9
Classifies characters.
Vowels=3 Consonants=7 Digits=3 Spaces=2 Others=1
Filters only letters.
HllWrld
Uses strlen.
Length = 5
Uses strcat safely.
Hello World
Manual copy loop.
Sample
Sorts array of strings.
apple banana cherry
Defines struct and prints.
Alice 20 92.5
Adds feet-inch distances.
9 feet 7 inch
Adds complex numbers.
4.0 + 5.0i
Subtracts times with borrow.
01:19:40
Allocates struct via malloc.
1 3.14
Writes a line to file.
Written.
Reads first line of file.
First line: Hello file
Prints contents of source via argv[0].
(program source content)
Simple star pyramid.
* *** ***** ******* *********
gcc program.c -o program && ./program. On Windows use MinGW; on macOS/Linux, compilers are available via package managers. Or use our free online C compiler to run code directly in your browser. -std=c99 flag or update your toolchain. C remains one of the most influential programming languages. According to the TIOBE Index, C consistently ranks in the top 2 languages worldwide.
gcc program.c -o program \&\& ./program| Compiler | Platform | Best For |
|---|---|---|
| GCC | Linux, macOS, Windows (MinGW) | General use, standards compliance |
| Clang | macOS, Linux, Windows | Fast compilation, clear errors |
| MSVC | Windows | Visual Studio, Windows APIs |
| Online | Any (browser) | Quick testing, no install |
Related:C Tutorial | Online C Compiler | C++ Examples
Short answer: Yes. C programmers are in demand across embedded systems, operating systems, IoT, automotive software, game engines, and systems programming. Companies like Intel, Qualcomm, NVIDIA, Samsung, Texas Instruments, and ISRO actively hire C developers. According to the TIOBE Index 2024, C consistently ranks in the top 2 most-used programming languages globally.
Entry-level C programming roles typically pay ₹4–8 LPA in India and $60,000–$90,000 in the US. With 3–5 years of experience in embedded C or systems programming, salaries jump to ₹15–30 LPA (India) or $100,000–$150,000 (US). The demand is especially strong in hardware companies and semiconductor firms.
Direct answer: C is used in roles where performance, hardware interaction, and memory control matter. Here are the key job categories:
It depends on your career goal. If you want to understand how computers actually work — memory, pointers, CPU architecture — start with C. If you want to build applications quickly (web, data science, automation) — start with Python. Here's the honest comparison:
| Criteria | C | Python |
|---|---|---|
| Learning difficulty | Hard (manual memory, pointers) | Easy (readable, forgiving) |
| Time to first program | 1–2 weeks | 1–2 days |
| Job market | Embedded, systems, hardware | Web, AI/ML, data science |
| Understanding of CS fundamentals | Deep (memory, OS, hardware) | Surface-level |
| Switching to other languages later | Easy (C → anything) | Moderate (Python → C is hard) |
| Best for | CS students, hardware roles | Beginners, data/web roles |
Our recommendation: If you're a CS/ECE student — learn C first, then Python. If you're a self-taught developer wanting web jobs — learn Python/JavaScript first, then C later if needed.
Before, if possible. Learning C first gives you a deep understanding of how variables are stored in memory, how functions use the call stack, and why certain operations are expensive. When you then switch to Python, you'll understand what Python hides from you (garbage collection, dynamic typing, reference counting) — making you a significantly better programmer.
However, if C's difficulty discourages you from programming entirely, start with Python to build confidence, then come back to C within 6 months. The worst outcome is giving up programming because C felt too frustrating.
Direct answer: C programming is used in four major domains, each with different skills and tools:
Not necessarily. Entry-level embedded C roles and fresh-graduate systems programming positions exist at companies like TCS, Infosys, Wipro, Continental, Bosch, and semiconductor startups. What matters more than years is demonstrable skill:
Five reasons C is worth learning in 2026:
Relevant certifications:
That said, certifications are secondary to projects and practical skills. A GitHub repo with a working TCP server written in C impresses interviewers more than any certificate.
| Language | Best For | Speed | Learning Curve | Job Market |
|---|---|---|---|---|
| C | Systems, embedded, hardware | Fastest | Hard | Niche but high-paying |
| C++ | Games, HFT, competitive prog | Very fast | Very hard | Large (finance, gaming) |
| Python | AI/ML, web, scripting | Slow | Easy | Largest overall |
| Rust | Safe systems programming | Fast (≈C) | Hard | Growing rapidly |
| Go | Backend, DevOps, cloud | Fast | Easy | Strong (infra companies) |
| Java | Enterprise, Android | Moderate | Moderate | Very large (enterprise) |
Absolutely yes. Despite being 50+ years old, C remains irreplaceable for:
C is not going anywhere. It's the assembly language of the 21st century — you don't write it for everything, but understanding it makes you a fundamentally better engineer.
Sources: TIOBE Index 2024, StackOverflow Developer Survey 2024, Statista IoT Report, LinkedIn Job Postings Data. Practice C with the examples above — each one runs directly in your browser via our online C compiler.