Skip to content

madhurimarawat/Learning-Programming-Concepts-With-C

Repository files navigation

πŸ“˜ Learning Programming Concepts with C

This repository contains C programming programs that I worked on during my B.Tech Semester 1 – C Programming Lab.

Learning Programming Concepts with C - Sample Output and Programs Overview

πŸ“š Notes, Slides & Study Materials

You can find the complete notes, slides, and study resources related to this subject here:
πŸ”— Semester 1 – Learning Programming Concepts with C

🎯 Key Highlights

  • 🧠 Beginner-friendly C programs
  • 🧩 Covers core programming concepts
  • πŸ“ Well-structured and commented code
  • I have also included the compiled .exe output files so you can directly run them and view the program output.
  • To run a program:
    • Either double-click the .exe file, or
    • Open the folder in Command Prompt and type:
      output-file-name.exe
      
    • Press Enter to see the output.
  • πŸŽ“ Useful for students, lab practice, and revision

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.


πŸ“‚ Directory Structure

Learning-Programming-Concepts-With-C/
β”‚
β”œβ”€β”€ Alphabet-Pattern/                 # πŸ”€ Alphabet pattern programs
β”‚   └── Alphabet-Pattern-EDCBA-Inverse-space-3.c
β”‚
β”œβ”€β”€ Basic-Programs/                   # 🧩 Basic C programs with comments
β”‚   └── (Multiple basic C programs)
β”‚
β”œβ”€β”€ Loops/                            # πŸ” Programs based on loops
β”‚   └── (for, while, do-while programs)
β”‚
β”œβ”€β”€ Number-Pattern/                   # πŸ”’ Number pattern programs
β”‚   └── (Various number pattern programs)
β”‚
β”œβ”€β”€ Recursion/                        # ♻️ Recursive function programs
β”‚   └── Largest-array-recursion.c
β”‚
β”œβ”€β”€ Star-Pattern/                     # ⭐ Star pattern programs
β”‚   └── (Different star pattern programs)
β”‚
β”œβ”€β”€ String-functions-library/         # πŸ“š Inbuilt string function programs
β”‚   └── (Programs using standard string library functions)
β”‚
β”œβ”€β”€ User-Defined_string-Function/     # πŸ› οΈ Custom string function implementations
β”‚   └── (User-defined string functions)
β”‚
β”œβ”€β”€ Output-Executables/               # βš™οΈ Compiled .exe output files
β”‚   └── (*.exe files for direct execution)
β”‚
β”œβ”€β”€ LICENSE                           # πŸ“œ License file
β”‚
└── README.md                         # πŸ“„ Project documentation

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 πŸ˜„