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, Sept 2021 compared to a year ago:

`
Rank Change Language Share Trend
1 Python 29.48 % -2.4 %
2 Java 17.18 % +0.7 %
3 Javascript 9.14 % +0.8 %
4 C# 6.94 % +0.6%
5 PHP 6.49 % +0.4 %
6 C/C++ 6.49 % +0.9 %
7 R 3.59 % -0.5 %
8 up arrow TypeScript 2.18 % +0.3 %
9 Swift 2.1 % -0.4 %
10 down arrow Objective-C 2.06 % -0.6 %
11 up arrow Kotlin1.91% +0.3 %
12 down arrow Matlab 1.74 % -0.1 %
13   Go 1.52 % +0.1 %
14 VBA 1.22 % -0.0 %
15 up arrow Rust 1.14 % +0.1 %
16 down arrow Ruby 1.13 % -0.0 %
17   Scala 0.84 % +0.0 %
18 up arrow Ada 0.78 % +0.2 %
19 down arrow Visual Basic 0.75 % -0.0 %
20 up arrow Dart 0.57 % +0.0 %
21 up arrow Abap 0.53 % +0.1 %
22 up arrow Julia 0.52 % +0.1 %
23 down arrow Lua 0.52 % -0.0 %
24 up arrow Groovy 0.43 % +0.0 %
25 Cobol 0.35 % -0.1 %
26 down arrow Perl 0.26 % -0.2 %
27 up arrow Delphi/Pascal 0.17 % -0.1 %
28 down arrow Haskell 0.0 % -0.3 %

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

TIOBE Index for September 2021

Sept 2021 Sept 2020 Change Programming Language Ratings Change
1 1 C 11.83% -4.12%
2 3 up arrow Python 11.67% +1.20%
3 2 down arrow Java 11.12% -2.37%
4 4 C++ 7.13% +0.01%
5 5 C# 5.78% +1.20%
6 6 Visual Basic 4.62% +0.50%
7 7 JavaScript 2.55% +0.01%
8 14 up arrow Assembly language 2.42% +1.12%
9 8 down arrow PHP 1.85% -0.64%
10 10 SQL 1.80% +0.04%
11 22 up arrow Classic Visual Basic 1.52% +0.77%
12 17 up arrow Groovy 1.46% +0.48%
13 15 up arrow Ruby 1.27% +0.03%
14 11 down arrow Go 1.13% -0.33%
15 12 down arrow Swift 1.07% -0.31%
16 16 MATLAB 1.02% -0.07%
17 37 up arrow Fortan 1.01% +0.65%
18 9 down arrow R 0.98% -1.40%
19 13 down arrow Perl 0.78% -0.53%
20 29 up arrow Delphi/Object Pascal 0.77% +0.24%

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

List of Exercises with Solutions :



C Programming: Tips of the Day

String literals: Where do they go?

A common technique is for string literals to be put in "read-only-data" section which gets mapped into the process space as read-only (which is why you can't change it).

It does vary by platform. For example, simpler chip architectures may not support read-only memory segments so the data segment will be writable.

Rather than try to figure out a trick to make string literals changeable (it will be highly dependent on your platform and could change over time), just use arrays:

char foo[] = "..."; 

The compiler will arrange for the array to get initialized from the literal and you can modify the array.

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