Skip to content

Instantly share code, notes, and snippets.

@024x
024x / dns.md
Last active August 15, 2023 03:29
Very Basic DNS Explanation for absolute beginners - A gist that explains the very basic concept of DNS (Domain Name System) for absolute beginners with examples - Satyendra

Domain Name System (DNS):

Imagine that you want to visit a friend's house, but you don't know their address. You only know their name and phone number. How would you find their house?

You could call them and ask for their address, right? But that would be inconvenient and time-consuming, especially if you have many friends and you want to visit them often. Wouldn't it be easier if you had a book that lists all your friends' names and addresses, so that you can just look them up whenever you want?

That's what DNS does for the Internet. It is a system that keeps a record of all the domain names (like www.google.com) and their corresponding IP addresses (like 216.58.216.164), so that you can find any website or service on the Internet by just typing its name in your web browser or other application.

But DNS is not just one book, it is a network of many books, or servers, that are distributed all over the world. Each server has a copy of some or all of the DNS records, and they can communicate with each oth

@024x
024x / gitcmds.md
Last active August 20, 2023 06:02
GIT & PIP commands (Basic's)

Git Cheat Sheet for Windows

replace s4tyendra with your username!

image

Open Terminal

@024x
024x / MCQ's To Test Understandings in C.md
Last active August 15, 2023 03:28
MCQ's to Test Understandings in C - A gist that contains multiple choice questions to test your understanding of various topics in C language. - Satyendra

MCQ's to Test Understandings in C


  1. What is C?
    • A) A high-level programming language
    • B) A low-level programming language
    • C) A scripting language
    • D) A markup language

@024x
024x / Error Handling and Command-Line Arguments.md
Last active August 15, 2023 03:28
Error Handling and Command-Line Arguments in C - A gist that explains how to handle errors and use command-line arguments in C language with examples. - Satyendra

Error Handling and Command-Line Arguments

Main Issue: The main issue addressed in this section is understanding error handling techniques in C programming and how to handle command-line arguments in C programs.

Bullet Points:

  • Error handling is an important aspect of programming to handle unexpected or erroneous situations and provide appropriate feedback to users.
  • C provides several techniques for error handling, including returning error codes from functions and using error-reporting functions like perror() and strerror().
  • When a function encounters an error, it can return a specific error code or a value indicating failure. The calling code can check the returned value and take appropriate actions based on the result.
  • The perror() function is used to print an error message based on the value of the global errno variable. It provides a descriptive error message related to the last system call that failed.
  • The strerror() function can be used to retrieve a descriptive error messag
@024x
024x / Advanced File Operations in C.md
Last active August 15, 2023 03:28
Advanced File Operations in C - A gist that explains how to perform advanced file operations such as copying, renaming, deleting, and appending files in C language with examples. - Satyendra

Advanced File Operations in C

Binary File I/O

Main Issue: Understanding binary file I/O in C programming and how to perform operations like reading and writing binary data to files.

Bullet Points:

  • In addition to text files, C also allows you to work with binary files, which store data in its raw binary format.
  • Binary files are useful for storing complex data structures, such as arrays, structures, and objects, directly to disk.
  • Binary file I/O involves reading or writing data in binary format, without any text conversion.
  • To work with binary files, you need to open the file in binary mode using the "b" flag in the file mode specifier.
@024x
024x / File_I-O_OperationsinC.md
Last active August 15, 2023 03:29
File I/O Operations in C - A gist that explains how to perform file input/output operations in C language with examples. - Satyendra

File I/O Operations in C

Introduction to File I/O

File I/O (Input/Output) operations in C involve working with files to perform tasks such as reading data from files and writing data to files. Files are used for long-term storage of data and allow us to store and retrieve information even after the program has terminated.

In C, file I/O is performed using the stdio.h library, which provides functions and utilities for handling file operations. The main file-related operations include opening, reading, writing, and closing files.

Basic File Operations

@024x
024x / Preprocessors.md
Last active August 15, 2023 03:30
Preprocessors A Beginner's Guide - A gist that explains the concept of preprocessors in C language with examples. - Satyendra

Day 4: Preprocessors

Introduction to Preprocessors:

In C programming, a preprocessor is a tool that processes your source code before it is compiled. It performs text manipulation and generates modified code, which is then passed to the compiler for compilation. Preprocessors are identified by directives starting with a # symbol.

Step 1: #include Directive:

The #include directive is used to include header files in your program. Header files contain declarations of functions, constants, and data structures that your program uses. By including the necessary headers, you can access the functionality provided by those libraries. Here's an example:

@024x
024x / pointers.md
Last active August 15, 2023 03:30
Pointers in C: A Beginner's Guide - A gist that explains the concept of pointers in C language with examples. - Satyendra

Pointers in C: A Beginner's Guide

Introduction:

Welcome to Day 3 of our C programming journey! Today, we will learn about pointers, a fundamental concept in C that allows us to work with memory directly. Pointers can be a bit confusing at first, but don't worry! We'll break it down step by step.

Step 1: Understanding Pointers:

A pointer is a special variable in C that stores the memory address of another variable. Think of it as a way to point to the location where a value is stored in the computer's memory. To declare a pointer, we use the * symbol. Here's an example:

@024x
024x / unions.md
Last active August 15, 2023 03:30
Unions in C: Explained in a Beginner-Friendly Manner - A gist that explains the concept of unions in C language with examples. - Satyendra

Unions in C: Explained in a Beginner-Friendly Manner

Introduction:

In the previous Note, we learned about structures in C, which allow us to group related data together. Today, we will dive into unions, another important concept in C. Unions are similar to structures in that they enable us to store multiple data types in a single entity. However, unlike structures, unions share the same memory space for all their members. In this way, unions offer flexibility in storing different types of data within the same memory location. Let's explore unions step by step.

Step 1: Understanding Unions:

A union in C is defined using the union keyword, followed by the union's name and a set of member variables. Here's an example to illustrate the syntax:

@024x
024x / structures.md
Last active August 28, 2023 03:59
Structures in c - Structures in more detailed and beginner-friendly manner - A gist that explains the concept of structures in C language with examples. - Satyendra

Structures in more detailed and beginner-friendly manner:

Map:

Main Issue: The main issue addressed in the text is explaining structures in a detailed and beginner-friendly manner in the context of the C programming language.

Bullet Points:

  • Structures in C allow you to group related data together and create custom data types by combining variables into a single entity.
  • To use structures, you need to declare variables of the structure type and access their members using the dot (.) operator.
  • Structures can be passed as arguments to functions or returned from functions, allowing you to perform operations on the grouped data.
  • An example program is provided that demonstrates the usage of structures to calculate the area of a rectangle.