18.9.25

Structs and Pointers





Structs and Pointers in C

Hey, everyone today I tried something new in C programming using structures with pointers and dynamic memory allocation. At first it looked confusing, but after working on it, I realized it’s actually super useful.

Code:

#include <stdio.h>
#include <stdlib.h>

struct Student {
    char name[50];
    int age;
    float marks;
};

int main() {
    struct Student* ptr;

   
    ptr = (struct Student*)malloc(sizeof(struct Student));

    if (ptr == NULL) {
        printf("Memory allocation failed!\n");
        return 1;
    }

    
    printf("Enter name: ");
    scanf_s("%49s", ptr->name, (unsigned)_countof(ptr->name));
    

    printf("Enter age: ");
    scanf_s("%d", &ptr->age);

    printf("Enter marks: ");
    scanf_s("%f", &ptr->marks);

    
    printf("\n--- Student Details ---\n");
    printf("Name: %s\n", ptr->name);
    printf("Age: %d\n", ptr->age);
    printf("Marks: %.2f\n", ptr->marks);

    
    free(ptr);

    return 0;
}
Output:




What I Learned

  • struct lets me group related data like name, age, and marks into one unit called Student.

  • With pointers, I can directly access and modify this struct in memory using ptr->field.

  • malloc gives memory at runtime (on the heap). This is better than static memory because it can adjust as per need.

  • Finally, I used free(ptr) to release memory, so my program doesn’t waste RAM.

Instead of just declaring one student normally, I learned how to manage memory myself. This is like leveling up in C programming. In the future, I’ll be able to handle multiple students or even bigger data structures dynamically.


16.9.25

Pointers Project


 


Hey, everyone I recently created a small project in C using pointers and structures. The program is a simple Student Record System where the user can enter the number of students, along with their name, age, and marks. The data is then stored dynamically in memory using malloc and displayed neatly on the screen.

This project helped me understand how powerful pointers are in C programming. Instead of fixing the size of an array, I learned how to allocate memory at runtime, which makes programs more flexible and efficient. I also used structures to group related data (like name, age, and marks) for each student, making the program more organized.


Code:

#include <stdio.h>

#include <stdlib.h>


struct Student {

    char name[50];

    int age;

    float marks;

};


int main() {

    int n, i;

    struct Student* ptr;

    printf("Enter number of students: ");

    scanf_s("%d", &n);    

    ptr = (struct Student*)malloc(n * sizeof(struct Student));

    if (ptr == NULL) {

        printf("Memory not allocated!\n");

        return 1;

    }   

    for (i = 0; i < n; i++) {

        printf("\nEnter details of student %d\n", i + 1);

        printf("Name: ");

        scanf_s("%s", ptr[i].name, (unsigned)_countof(ptr[i].name));

        printf("Age: ");

        scanf_s("%d", &ptr[i].age);

        printf("Marks: ");

        scanf_s("%f", &ptr[i].marks);

    }    

    printf("\n--- Student Records ---\n");

    for (i = 0; i < n; i++) {

        printf("Student %d: %s, Age: %d, Marks: %.2f\n",

            i + 1, ptr[i].name, ptr[i].age, ptr[i].marks);

    }

    free(ptr); 

    return 0;

}

Output: 






11.9.25

My Plan





Hi! What's up. I’m an 18-year-old in my 2nd year of an IT Diploma, and I’m keeping it real: I’m focusing on C Language. Not overcomplicating things. Here’s my clear plan to become a software engineer.


Why C? 


- It’s the foundation. Learn C, and everything else makes sense.  

- Used in embedded systems, OS development, compilers stuff that needs to be fast and          efficient.  

- Understanding memory, pointers, and low-level execution will make me better in ANY        language.


The Plan – Simple and Focused:

1. Complete My Diploma in IT 

Right now, I’m focusing on finishing my diploma with good grades. I’m also learning programming languages like C/C++ on the side to improve my coding skills.

2. Do a Degree in Computer Science / IT

After my diploma, I’ll go for a degree in Computer Science or IT. This will help me learn advanced subjects like Data Structures, Algorithms, and Software Development

3. Build Skills + Internships + Job 

Along with studies, I’ll keep practicing coding on platforms like LeetCode and GitHub. I plan to do internships during college to get real-world experience. After that, I’ll apply for jobs in software companies and start my career.


After Diploma: 

Lateral Entry into B.Tech CS or IT

- Join B.Tech directly in the 2nd year.  

- My C skills and project experience will put me ahead of the curve.


Final Goal:  

Become a Systems Software Engineer or Embedded Software Engineer. C might not be trendy, but it’s powerful, respected, and in demand.


23.8.25

HTML Learning Notes (from Video) - 6

  The video's link - https://youtu.be/HcOc7P5BMi4?si=eIuDDGoj-5D3r6pV 

  


Chapter 6: Beyond HTML


Roadmap after HTML



  • The first step after HTML is CSS. CSS is used to style the page colors, fonts, layouts, spacing, everything that makes a website beautiful.
  • After CSS, comes JavaScript (JS). This adds life to your website. With JavaScript, your page can react to clicks, show alerts, handle forms, and update content without reloading.

  • Once you are good with HTML, CSS, and JS (this is the frontend), you move to the backend. Backend means server-side programming, databases, and handling user data.

Full-Stack Development Path



  • Frontend = HTML + CSS + JavaScript = what the user sees.

  • Backend = server + database = what happens behind the scenes.

  • When you learn both, you become a Full-Stack Developer, which means you can build a complete website from scratch, both front and back.

Continuous Practice Through Projects



  • The best way to learn web development is to keep practicing.

  • Don’t just read tutorials; make projects like:

    • A personal portfolio website

    • A simple calculator

    • A to-do list app

  • Each project teaches you new skills and makes your concepts stronger.

Learning from Real Websites



  • You don’t have to only rely on books or courses. The internet itself is your teacher.

  • Open any website, right-click, and choose Inspect.

  • This shows you the HTML and CSS used on that page.

  • By exploring, you’ll see how professional developers build real-world websites.



22.8.25

HTML Learning Notes (from Video) - 5

  The video's link - https://youtu.be/HcOc7P5BMi4?si=eIuDDGoj-5D3r6pV 

  


Chapter 5: Projects 


Personal Portfolio Website




  • A portfolio website is like an online resume where you introduce yourself and show your skills and projects.

  • The homepage should include your name, photo, and an introduction to give visitors a quick idea about you.

  • Add sections such as About Me, Education, Skills, Projects, and Contact so that information is well organized.

  • Use navigation links at the top to make it easy to move between sections or pages.

  • You can also add links to make it more professional.

  • This type of project is very useful for students to showcase their work to teachers 

Contact Form with Inputs



  • A contact form allows people to send you messages directly from the website.

  • It usually has inputs for Name, Email, Subject, and a Message box.

  • Use the <form> tag with input types like text, email, and textarea for longer messages.

  • Labels should be added with inputs to make the form accessible and easier to use.

  • Always include a submit button so the data can be sent.

  • Forms can be connected to a backend like PHP, Node.js, or Google Forms to actually process the messages.

  • Adding a contact form makes the site more interactive and professional.

Resource Library for Students



  • A resource library is a page where study materials like PDFs, notes, videos, and tutorials are stored.

  • You can divide the resources into categories like HTML, CSS, JavaScript, or Databases for easy navigation.

  • Use lists or tables to display resources neatly so students can quickly find what they need.

  • Add direct download links for PDFs, assignments, or notes.

  • Embedding videos or slides can make the library more interactive and useful.

  • This type of project is very helpful in schools or colleges as it collects all resources in one place.

Embedding Multimedia Content



  • Multimedia makes a website more engaging and enjoyable for the user.

  • Use the <video> tag to add videos with controls for play, pause, and volume.

  • The <audio> tag can be used to add music, podcasts, or sound effects.

  • You can embed online content like YouTube videos, Google Maps, or presentations using iframes.

  • Always provide captions or alternative text so multimedia is accessible to everyone.

  • This is commonly used in tutorials, entertainment sites, blogs, and learning platforms.


21.8.25

HTML Learning Notes (from Video) - 4

 The video's link - https://youtu.be/HcOc7P5BMi4?si=eIuDDGoj-5D3r6pV 

  


Chapter 4: Professional HTML 

Best Practices



  • Always write clean, indented code → makes debugging and teamwork easier.

  • Use comments (<!-- -->) to explain sections of code (like header, footer, nav).

  • Keep your HTML structured and readable → separate content, design, and scripts.

  • Avoid unnecessary tags → keeps file lightweight.

  • Follow semantic HTML for better SEO and meaning.


Accessibility



  • Always add alt text for images → useful for screen readers and image loading errors.

  • Use <label> with form inputs so users know the purpose of fields.

  • Ensure keyboard navigation works (tab-friendly forms, buttons).

  • Good accessibility → better SEO + user experience.

  • Helps people with disabilities access your site easily.


Iframes Limitations



  • Can cause security risks.

  • Slower page loading.

  • Not always mobile-friendly.

  • Best for maps, videos, widgets.

Live Server



  • VS Code extension for auto-refresh.

  • Saves time, no manual reloading.

  • Speeds up development.

Project Organization

  • Use separate folders (CSS, JS, images).

  • Name files properly (index.html, about.html).

  • Link pages with <a href="about.html">.

  • Keeps websites professional and easy to manage.

Extra Points 



  • Use Semantic Tags (<header>, <footer>, <section>, <article>) → improves SEO and accessibility.
  • Cross-browser Compatibility → Test pages on different browsers (Chrome, Firefox, Edge) to avoid layout issues.

  • Responsive Design → Use <meta name="viewport"> for mobile-friendly websites.

  • External CSS & JS → Always link CSS/JS instead of mixing them into HTML → makes code cleaner.

  • File Naming Rules → Use lowercase names, avoid spaces (e.g., about-us.html).

  • Validation → Check HTML with W3C Validator to catch errors and improve quality.


20.8.25

HTML Learning Notes (from Video) - 3

The video's link - https://youtu.be/HcOc7P5BMi4?si=eIuDDGoj-5D3r6pV 

  


Chapter 3: Intermediate HTML 


Forms



  • <form> → Starts form.

  • Input types:

    • text → Single line input.

    • password → Hidden input.

    • radio → Choose one option.

    • checkbox → Choose multiple options.

    • dropdown<select><option>.

    • textarea → Multi-line text.

  • <input type="submit"> → Submit button.

<label> Tag



  • Connects text with input field using for.

  • Helps screen readers & improves accessibility.

  • Clicking label focuses input field.

Attributes for Styling



  • id → Unique (only for one element).

  • class → Group of elements (reusable).

  • Useful for CSS styling & JavaScript functions.


Block vs Inline Elements



  • Block (<div>) → Full width, new line.

  • Inline (<span>) → Only content width, stays in line.

Semantic Tags



  • <header> → Top area (logo, nav).

  • <footer> → Bottom area (copyright).

  • <main> → Main page content.

  • <section> → Group of related content.

  • <article> → Independent content (blog, news).

  • <aside> → Side info (ads, sidebar).

  • <nav> → Navigation links.

Why Semantic HTML?



  • SEO → Search engines understand better.

  • Accessibility → Screen readers identify page parts.

  • Clean Code → Easier maintenance.

Structuring Multi-Page Websites



<nav>
  <a href="index.html">Home</a>
  <a href="about.html">About</a>
  <a href="contact.html">Contact</a>
</nav>
  • Use <nav> for menus.

  • Link multiple pages with relative paths (about.html).


19.8.25

HTML Learning Notes (from Video) - 2

The video's link - https://youtu.be/HcOc7P5BMi4?si=eIuDDGoj-5D3r6pV 

      

HTML Learning Notes (from Video)

Chapter 2: HTML Basics




HTML structure

  • Every HTML page has  :

    • <html> = holds the whole web page together

    • <head> = the brain of the webpage (title, metadata, styles, etc.)

    • <body> = the stuff you actually see

Tags, Elements, Attributes & Comments



  • Tag: <p> (like an opening signboard)

  • Element: <p>Hello</p> (full package, open + content + close)

  • Attribute: Extra info inside a tag: <img src="cat.jpg" alt="little cat">

  • Comments: <!-- This is invisible --> (your secret notes )

Paragraphs & Headings



  • <p> = paragraph, keeps text neat.

  • Headings: <h1> (biggest) → <h6> (smallest).

Links with <a>

  • <a href="https://google.com">Google</a> → absolute URL  (full web address).

  • <a href="about.html">About</a> → relative URL  (inside your own project).

Images with <img>



  • <img src="dog.jpg" alt="A dog">

  • src = where the picture lives 

  • alt = backup text if image doesn’t load (also helps blind users ).

Lists




  1. Unordered list <ul> → bullet points 

  2. Ordered list <ol> → numbered 1, 2, 3

  3. Definition list <dl> → term + description 


Media & Iframes



  • <video> → embed videos.

  • <audio> → embed sound/music.

  • <iframe> → window to another webpage (YouTube, maps).


Tables



  • <table> → whole table.

  • <tr> → row.

  • <td> → cell (data).

  • <th> → header (bold).

  • <caption> → table title.


18.8.25

HTML notes (from Video)

The video's link - https://youtu.be/HcOc7P5BMi4?si=eIuDDGoj-5D3r6pV 

HTML Learning Notes (from Video)

Chapter 1: Getting Started with HTML

What is HTML?

HTML = Hypertext Markup Language.

It’s basically the blueprint of every website. Without HTML, the internet would just be a blank page no text, no images, nothing.
Think of it like the skeleton of the human body. You don’t see it directly, but without it, nothing stands.

and HTML is not a programming language. It doesn’t do “math's” or “logic.” It just organizes and displays content.

Difference between HTML, CSS, and JavaScript



Imagine you’re building a house (or your setup):

  • HTML → The structure (walls, tables, monitor stand).

  • CSS → The style (paint, wallpapers, RGB lights ).

  • JavaScript → The brain/behavior (auto doors, Alexa voice commands, games reacting to clicks).

Together, they make a full, working, good-looking website.

Why learn HTML first?



You can’t paint a house (CSS) or install gadgets (JavaScript) without building the walls (HTML).
Same with websites → HTML comes first.
It’s like learning alphabets before writing essays 

Tools You Need

Now, yes, you can write HTML in Notepad… but that’s like trying to edit a movie on a basic phone. Painful.
Better choices:

  • VS Code → free, powerful, with auto-suggestions and even live preview (saves you from refreshing again & again).

  • Notepad → works, but honestly, avoid unless you enjoy suffering .

Inspect Element & View Source



Ever right-clicked on a webpage and hit Inspect? That’s like peeking behind the curtain of the internet.

  • View Source: Shows the raw HTML (like reading a book’s script).

  • Inspect Element: Lets you play around, change stuff temporarily (like renaming “Submit” to “Send to my guy plz ”).



2.8.25

Understanding Pointers



Program: Understanding Pointers 

#include <stdio.h>

int main() {
    int a = 10;          
    int *p;              

    p = &a;              
    
    printf("Value of a: %d\n", a);
    printf("Address of a: %p\n", &a);
    printf("Value stored in p (address of a): %p\n", p);
    printf("Value pointed to by p: %d\n", *p); // dereferencing

    
    *p = 20;
    printf("\nAfter changing *p to 20:\n");
    printf("New value of a: %d\n", a);
    
    return 0;
}

Explanation 

Code what does it do?
int a = 10;         Declares an integer a and sets it to 10.
int *p;         Declares a pointer p that can store the address of an integer.
p = &a;         Stores the address of a into p. Now p “points to” a.
*p         Dereferences the pointer, i.e., gets the value stored at the address in p.
*p = 20;         Changes the value at the address stored in p to 20 (so a becomes 20).

What you’ll see in output:

Value of a: 10
Address of a: 0x7ffee63b4a5c       
Value stored in p (address of a): 0x7ffee63b4a5c
Value pointed to by p: 10

After changing *p to 20:
New value of a: 20

Key Things:

  • Pointer (*p): A variable that stores the address of another variable.

  • Address-of (&a): Gets the memory address of variable a.

  • Dereferencing (*p): Accesses the value stored at the address the pointer points to.


1.8.25

Array Input and Output in C: With and Without Loops

 

Arrays in C 



(Same Output, But still different!)

So I was learning arrays in C, and I tried two different styles to take and print 5 numbers.
One uses a loop, and one doesn’t, but both give the exact same output! 

Here's what have i done:

Program 1: Using a Loop 

#include <stdio.h>

int main() {
    int numbers[5];
    int i;

    printf("Enter 5 numbers:\n");
    for(i = 0; i < 5; i++) {
        scanf_s("%d", &numbers[i]);
    }

    printf("You entered:\n");
    for(i = 0; i < 5; i++) {
        printf("%d\n", numbers[i]);
    }

    return 0;
}

What it does:

  • Creates an array with 5 elements

  • Uses a for loop to take input and print it

  • Code is shorter and cleaner

Program 2: Without a Loop 

#include <stdio.h>

int main() {
    int num[5];

    printf("Enter 5 numbers:\n");
    scanf_s("%d", &num[0]);
    scanf_s("%d", &num[1]);
    scanf_s("%d", &num[2]);
    scanf_s("%d", &num[3]);
    scanf_s("%d", &num[4]);

    printf("You entered:\n");
    printf("%d\n", num[0]);
    printf("%d\n", num[1]);
    printf("%d\n", num[2]);
    printf("%d\n", num[3]);
    printf("%d\n", num[4]);

    return 0;
}

What it does:

  • Also takes and prints 5 numbers

  • No loops, just direct scanf_s and printf

  • Easy to understand, but not good for large inputs

Same Output Example:

If user enters:
10 20 30 40 50

Both programs will print:

You entered:
10
20
30
40
50


rating System

Loading...

A Friendship Story of Learning Data Structures with C

Sr. No. DSU BLOGS CHAPTERS 1 Array Operations in C, The Group of Friendship (Create, Insert, Delete ...