Skip to content

vixhnuchandran/c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basics of C Programming

This repository contains a collection of simple C programming examples that cover fundamental concepts of the C language. Each file demonstrates a specific topic, making it a valuable resource for beginners looking to learn and practice C programming.

Overview

C is a powerful general-purpose programming language that is widely used for system programming, embedded systems, and application development. This collection aims to introduce the core concepts of C programming in a straightforward manner.

File List

  1. 0.HelloWorld.c: A simple program that prints "Hello, World!" to the console. This file introduces the basic structure of a C program.

  2. 1.Variables.c: Demonstrates how to declare and initialize variables of different data types, including integers, floats, and characters.

  3. 2.DataTypes.c: Explains the various data types available in C, such as int, float, char, and their characteristics.

  4. 3.FormatSpecifiers.c: Shows how to use format specifiers in printf and scanf for displaying and taking input of different data types.

  5. 4.Constants.c: Introduces constants in C, including how to define and use constant values in programs.

  6. 5.ArithmeticOperators.c: Demonstrates the use of arithmetic operators (+, -, *, /, %) for performing basic mathematical calculations.

  7. 6.UserInput.c: Shows how to read user input using scanf, along with basic input validation.

  8. 7.MathFunctions.c: An introduction to standard math functions provided by the math.h library for performing advanced mathematical operations.

  9. 8.IfStatements.c: Explains conditional statements using if, else if, and else to control the flow of execution.

  10. 9.SwitchStatements.c: Demonstrates the use of the switch statement for multi-way branching based on variable values.

  11. 10.LogicalOperators.c: Introduces logical operators (&&, ||, !) and their use in forming complex conditions.

  12. 11.Functions.c: Covers the concept of functions in C, including function declaration, definition, and how to call them.

  13. 12.Arguments.c: Demonstrates how to pass arguments to functions and use them within the function body.

  14. 13.Return.c: Explains the use of return statements in functions and how to return values from them.

  15. 14.TernaryOperator.c: Introduces the ternary conditional operator for simplifying conditional expressions.

  16. 15.FunctionPrototype.c: Covers the use of function prototypes to declare functions before they are defined.

  17. 16.StringFunctions.c: Demonstrates basic string operations using functions from the string.h library, including string length and concatenation.

  18. 17.ForLoops.c: An introduction to for loops, covering their syntax and how to use them for iterating over a range of values.

  19. 18.WhileLoops.c: Explains while loops and their use for repeated execution based on a condition.

  20. 19.DoWhileLoops.c: Introduces do while loops and how they ensure at least one execution of the loop body.

  21. 20.NestedLoops.c: Demonstrates nested loops and their applications in multi-dimensional data processing.

  22. 21.ControlFlowKeywords.c: Covers various control flow keywords in C, including break, continue, and goto, explaining their purposes and use cases.

  23. 23.2DArrays.c: Demonstrates the use of two-dimensional arrays for storing and manipulating tabular data, including accessing and modifying elements.

  24. 24.ArrayOfStrings.c: Shows how to handle arrays of strings in C, including declaration, initialization, and basic string manipulation.

  25. 25.SwapValues.c: Demonstrates different methods for swapping the values of two variables using temporary variables and pointers.

  26. 26.SortAnArray.c: Introduces basic sorting algorithms, such as bubble sort and selection sort, for organizing data in arrays.

  27. 27.Structs.c: Explains how to define and use structures for grouping related variables of different data types under a single name.

  28. 28.Typedef.c: Demonstrates how to create new type names (aliases) for existing data types using typedef, enhancing code readability.

  29. 29.Enums.c: Covers enumerated types (enums) for defining variables that can hold a set of predefined constants, enhancing code readability.

  30. 30.RandomNumbers.c: Shows how to generate random numbers in C using the rand() function and seed them with srand() for randomness.

  31. 31.BitwiseOperators.c: Introduces bitwise operators (&, |, ^, ~, <<, >>) and their applications in low-level programming and data manipulation.

  32. 32.Memory.c: Covers concepts of memory management, including stack vs. heap memory allocation and the importance of freeing dynamically allocated memory.

  33. 33.Pointers.c: Provides a deeper understanding of pointers, including pointer arithmetic and the relationship between arrays and pointers.

  34. 34.WritingFiles.c: Demonstrates how to create and write data to files using fopen() and fprintf(), along with error checking for file operations.

  35. 35.ReadingFiles.c: Explains how to read data from files using fopen() and fscanf(), demonstrating techniques for processing file input.

Getting Started

To compile and run the examples, you'll need a C compiler (e.g., GCC) installed on your machine. You can compile an example with the following command:

gcc <filename.c> -o <output_executable>