Skip to content

madhurimarawat/Learning-Programming-Concepts-With-C

Repository files navigation

Learning-Programming-Concepts-With-C

This repository contains programs in the C programming language.


About C Programming



--> C is a general-purpose programming language.

--> It is Procedural Programming language.

--> It has been used to develop operating systems, databases and applications.

--> It is Middle Level Programming language and gives more control to Programmer.


Mode of Execution used

GCC Compiler

--> GCC stands for GNU C/C++ Compiler.

--> To begin with GCC, visit the official website  

--> Download GCC according to the platform being used like Linux, MacOs or Windows.

--> Follow the setup wizard.

--> Write c code in any text editor or IDE and save it with .c extention.

--> Then just open the console and run this command -

gcc filename.c -o Output

--> Filename is the name of the C script file and Output is the name of the output file.

--> After this command is executed, if the code is successfully compiled output file will be saved in the same location as the code file.

--> Once this Output file is executed in command prompt, the output will be displayed.


C Programming Features


Data Types in C

1.Primary Data Types

Primitive data types are the most basic data types that are used for representing simple values such as integers, float, characters, etc.

i) Integer

--> The integer datatype in C is used to store the whole numbers without decimal values.

--> Octal values, hexadecimal values, and decimal values can be stored in int data type in C.

  • Range: -2,147,483,648 to 2,147,483,647
  • Size: 4 bytes
  • Format Specifier: %d

ii) Float

--> In C programming float data type is used to store floating-point values.

--> Float in C is used to store decimal and exponential values.

--> It is used to store decimal numbers (numbers with floating point values) with single precision.

  • Range: 1.2E-38 to 3.4E+38
  • Size: 4 bytes
  • Format Specifier: %f

iii) Character

--> Character data type allows its variable to store only a single character.

--> The size of the character is 1 byte. It is the most basic data type in C.

--> It stores a single character and requires a single byte of memory in almost all compilers.

  • Range: (-128 to 127) or (0 to 255)
  • Size: 1 byte
  • Format Specifier: %c

2. Void

--> The void data type in C is used to specify that no value is present.

--> It does not provide a result value to its caller.

--> It has no values and no operations.

--> It is used to represent nothing. Void is used in multiple ways as function return type, function arguments as void, and pointers to void.

3. Enumerated Type

--> In computer programming, an enumerated type (also called enumeration) is a data type consisting of a set of named values called elements, members, enumeral, or enumerators of the type.

--> The enumerator names are usually identifiers that behave as constants in the language.

i) Enum

--> Enumeration (or enum) is a user defined data type in C. It is mainly used to assign names to integral constants, the names make a program easy to read and maintain.

--> The keyword ‘enum’ is used to declare new enumeration types in C.

4. Derived Data Types

The data-types that are derived from the primitive or built-in datatypes are referred to as Derived Data Types.

i) Array

--> An array in C is a fixed-size collection of similar data items stored in contiguous memory locations.

--> It can be used to store the collection of primitive data types such as int, char, float, etc., and also derived and user-defined data types such as pointers, structures, etc.

ii) Pointer

--> Pointers are symbolic representations of addresses.

--> They enable programs to simulate call-by-reference as well as to create and manipulate dynamic data structures.

--> Iterating over elements in arrays or other data structures is one of the main use of pointers.

iii) Structure

--> The structure in C is a user-defined data type that can be used to group items of possibly different types into a single type.

--> The struct keyword is used to define the structure in the C programming language.

--> The items in the structure are called its member and they can be of any valid data type.

iv) Union

--> A union is a special data type available in C that allows to store different data types in the same memory location.

--> Union can be defined with many members, but only one member can contain a value at any given time.

--> Unions provide an efficient way of using the same memory location for multiple-purpose.

Thanks for Visiting 😄

  • Drop a 🌟 if you find this repository useful.

  • If you have any doubts or suggestions, feel free to reach me.

    📫 How to reach me:   Linkedin Badge     Mail Illustration📫

  • Contribute and Discuss: Feel free to open issues 🐛, submit pull requests 🛠️, or start discussions 💬 to help improve this repository!