w3resource

C Programming Exercises, Practice, Solution

What is C Programming Language?

C is a general-purpose, imperative computer programming language, supporting structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations.

C was originally developed by Dennis Ritchie between 1969 and 1973 at Bell Labs, and used to re-implement the Unix operating system. It has since become one of the most widely used programming languages of all time, with C compilers from various vendors available for the majority of existing computer architectures and operating systems.

The best way we learn anything is by practice and exercise questions. We have started this section for those (beginner to intermediate) who are familiar with C programming.

Hope, these exercises help you to improve your C programming coding skills. Currently, following sections are available, we are working hard to add more exercises .... Happy Coding!

List of C Programming Exercises :

[ Want to contribute to C exercises? Send your code (attached with a .zip file) to us at w3resource[at]yahoo[dot]com. Please avoid copyrighted materials.]

Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.

Popularity of Programming Language
Worldwide, Jul 2022 compared to a year ago:

`
Rank Change Language Share Trend
1 Python 28.38 % -2.3 %
2 Java 17.5 % -0.7 %
3 Javascript 9.29 % +0.1 %
4 C# 7.63 % +0.5%
5 C/C++ 6.48 % -0.1 %
6 PHP 5.32 % -1.0 %
7 R 4.13 % +0.4 %
8 up arrow TypeScript 2.55 % +0.8 %
9 down arrow Objective-C 2.13 % +0.3 %
10 up arrow Swift 1.95 % +0.3 %
11 up arrow Go1.7% +0.2 %
12 Matlab 1.67 % +0.2 %
13 down arrow Kotlin 1.58 % -0.2 %
14 up arrow Rust 1.29 % +0.5 %
15 down arrow VBA 1.13 % -0.1%
16 down arrow Ruby 1.09 % -0.0 %
17 up arrow Ada 0.86 % +0.3 %
18 up arrow Scala 0.78 % +0.3 %
19 down arrow Visual Basic 0.71 % -0.0 %
20 down arrow Dart 0.64 % +0.0 %
21 down arrow Abap 0.56 % +0.0 %
22 down arrow Lua 0.53 % +0.1 %
23 Groovy 0.45 % +0.0 %
24 down arrow Julia 0.43 % +0.1 %
25 down arrow Perl 0.38 % +0.0 %
26 Cobol 0.35 % +0.0 %
27 Haskell 0.31 % +0.1 %
28 Delphi/Pascal 0.18 % +0.2 %

Source : https://pypl.github.io/PYPL.html

TIOBE Index for June 2022

June 2022 June 2021 Change Programming Language Ratings Change
1 2 up arrow Python 12.20% +0.35%
2 1 down arrow C 11.91% -0.64%
3 3 Java 10.47% -1.07%
4 4 C++ 9.63% +2.26%
5 5 C# 6.12% +1.79%
6 6 Visual Basic 5.42% +1.40%
7 7 JavaScript 2.09% -0.24%
8 10 up arrow SQL 1.94% +0.06%
9 9 Assembly language 1.85% -0.21%
10 16 up arrow Swift 1.55% +0.44%
11 11 Classic Visual Basic 1.33% -0.40%
12 18 up arrow Delphi/Object Pascal 1.32% +0.26%
13 8 down arrow PHP 1.25% -0.97%
14 23 up arrow Objective-C 1.02% +0.33%
15 20 up arrow Go 1.02% +0.07%
16 14 down arrow R 0.98% -0.22%
17 15 down arrow Perl 0.76% -0.41%
18 38 up arrow Lua 0.76% +0.43%
19 13 down arrow Ruby 0.75% -0.48%
20 26 up arrow Prolog 0.74% +0.18%

Source : https://www.tiobe.com/tiobe-index/

List of Exercises with Solutions :



C Programming: Tips of the Day

"#include" a text file in a C program as a char[]

$ echo hello world > a
$ xxd -i a

Sample Output:

unsignedchar a[] = {
0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x0a
};
unsignedint a_len = 12;

Ref : https://bit.ly/3hDnOcj