DataType Selection in C | ডেটা টাইপের মূল ধারণা

Everything in a computer’s memory is stored as 0s and 1s, but why do we need to choose a data type? C Data Types In the C language, the basic data types are: char → a single character or a small number int → a whole number (integer) float → a decimal number with small precision double → a decimal number with higher precision What you’ll learn in this video: What a data type is and why it’s important Basic C data types: char, int, float, double How to choose the right data type for different values Differences between char, string, and decimal numbers Simple practical examples explained clearly

CGPA & Grade Calculator in C

Learn how to build a CGPA & Grade Calculator in C step-by-step. Final code #include<stdio.h> // mark between 0 -100 float cgpa(float mark){ if(mark>100 || mark < 0) return 0; else if(mark >= 80) return 4.0; else if(mark >= 75) return 3.75; else if(mark >= 70) return 3.50; else if(mark >= 65) return 3.25; else if(mark >= 60) return 3.00; else if(mark >= 55) return 2.75; else if(mark >= 50) return 2.50; else if(mark >= 45) return 2.25; else if(mark >= 40) return 2.00; else return 0.0; } // CGPA to grade, where [cgpa] is between 0 - 4.0 char* cgpaToGrade(float cgpa) { if (cgpa > 4.0 || cgpa < 0) return "F"; else if(cgpa >= 4.0) return "A+"; else if(cgpa >= 3.75) return "A"; else if(cgpa >= 3.5) return "A-"; else if(cgpa >= 3.25) return "B+"; else if(cgpa >= 3.0) return "B"; else if(cgpa >= 2.75) return "B-"; else if(cgpa >= 2.5) return "C+"; else if(cgpa >= 2.25) return "C"; else if(cgpa >= 2.0) return "D"; else return "F"; } /// [avg] is the mark between 0 - 100 char* calculateGrade(float avg){ if (avg>100) return "invalid number"; else if(avg >= 80) return "A+"; else if(avg >= 75) return "A"; else if(avg >= 70) return "A-"; else if(avg >= 65) return "B+"; else if(avg >= 60) return "B"; else if(avg >= 55) return "B-"; else if(avg >= 50) return "C+"; else if(avg >= 45) return "C"; else if(avg >= 40) return "D"; else return "F"; } int main(){ int n, total=0; float cgpaTotal=0.0; printf("How many subject you like to calculate: "); scanf("%d", &n); for(int i=0; i< n; i++){ int number ; printf("Enter your %d subject Mark: ", i +1); scanf("%d", &number); cgpaTotal += cgpa(number); total += number; } float avg = total/n; float result = cgpaTotal / n; char* grade = cgpaToGrade(result); printf("total number %d, average %.2f\n", total, avg); printf("Your CGPA %.2f %s\n", result, grade); return 0; }

Struct Dynamic Memory

We will learn how to store student struct with Dynamic memory. Dynamic Memory Struct #include <stdio.h> #include <stdlib.h> #include <string.h> struct Student { int id; char *name; }; int main(void) { struct Student *s = malloc(sizeof( struct Student)); if(!s){ // s == NULL perror("allocation failed"); return 1; } scanf("%d", &s->id); char temp[100]; scanf("%99s",temp); (*s).name = malloc(strlen(temp) + 1); if (!s->name){ perror("failed to allocate name"); free(s); return 1; } strcpy(s->name, temp); printf("\n%d\n", s->id); printf("Name: %s\n", s->name); free(s); return 0; } Student array #include <stdio.h> #include <stdlib.h> #include <string.h> struct Student { int id; char *name; }; int main(void) { struct Student *s = malloc(2 * sizeof(struct Student)); if (!s) { perror("allocation failed"); return 1; } for (int i = 0; i < 2; i++) { printf("Enter ID and name: "); scanf("%d", &s[i].id); char temp[100]; scanf("%99s", temp); s[i].name = malloc(strlen(temp) + 1); if (!s[i].name) { perror("failed to allocate name"); // free any previously allocated names before exiting for (int j = 0; j < i; j++) { free(s[j].name); } free(s); return 1; } strcpy(s[i].name, temp); printf("\nID: %d\n", s[i].id); printf("Name: %s\n", s[i].name); } // ✅ free all names after use for (int i = 0; i < 2; i++) { free(s[i].name); } free(s); return 0; } Simplify with function #include <stdio.h> #include <stdlib.h> #include <string.h> struct Student { int id; char *name; }; void freeStudent(struct Student *s, int counter){ for(int i =0; i<counter; i++){ free(s[i].name); } free(s); } int main(void) { int N = 2; struct Student *s = malloc(N*sizeof( struct Student)); if(!s){ // s == NULL perror("allocation failed"); return 1; } for (int i=0; i< N; i++) { printf("Enter id:"); scanf("%d", &s[i].id); char temp[100]; printf("Enter name: "); scanf("%99s",temp); s[i].name = malloc(strlen(temp) + 1); if (!s[i].name){ perror("failed to allocate name"); freeStudent(s,i); return 1; } strcpy(s[i].name, temp); printf("\n%d\n", s[i].id); printf("Name: %s\n\n", s[i].name); } freeStudent(s,N); return 0; }

String in C

আমরা দেখাবো printf, multi-line print, char define করার N উপায়, pointer vs array, এবং puts function। char str[] = "World"; store like Strings-এর User Input scanf, gets, fgets, getchar/putchar — ত্রুটি ও অপটিমাইজেশন। printf("10.4s","hello") will show like ...

Recursive Factorial Explained

কীভাবে Factorial Function, এবং Recursive Approach ব্যবহার করে Factorial বের করা যায়। Recursive Factorial int factorial(int n){ if (n==0) return 1; else return n * factorial(n-1); } How it works When n is 5,

Print N & sum of N number - loop Part(2,3)

এই ভিডিওতে আমি প্রোগ্রামিংয়ে লুপের বেসিক বিষয়গুলো সহজ কোড উদাহরণসহ বুঝিয়েছি। আপনি শিখবেন: ✅ For Loop → ১ থেকে n পর্যন্ত সংখ্যা প্রিন্ট করা ✅ Break & Continue → লুপের প্রবাহ নিয়ন্ত্রণ করা ✅ Infinite Loop → লুপ এক্সপ্রেশন ছাড়া কিভাবে হ্যান্ডেল করতে হয় এই ভিডিওতে আমি দেখিয়েছি কিভাবে একটি সহজ For Loop ব্যবহার করে N সংখ্যার যোগফল বের করতে হয়। ...

C Variable Define & Naming Rules

এই ভিডিওতে আমরা শিখব C Programming এ কিভাবে Variable Define করতে হয় এবং Naming Rules বা ভ্যারিয়েবলের নামকরণের নিয়মগুলো। What you’ll learn in this video: Variable কীভাবে কাজ করে Variable Define করার নিয়ম Naming Rules (কোন নামগুলো ব্যবহার করা যাবে, কোনগুলো যাবে না) Common ভুল এবং সেগুলো কিভাবে এড়ানো যায়

Quiz Game in C (File-Based)

Build a Quiz Game in C that reads questions from a file! We also learn from hardcoded questions first before moving to file-based input. What You’ll Learn: Reading questions and answers from a file Using arrays and strings to manage data Implementing scoring logic txt file data Our quiz.txt file contains questions in the following format: ...

typedef & enum

Simplify and Name Data Types C Programming Bangla-এ কিভাবে typedef এবং enum ব্যবহার করে data type সহজে define ও নামকরণ করা যায়। ভিডিওতে দেখানো হয়েছে typedef struct, enum creation, typedef enum এবং practical coding examples। Beginners এবং self-learners এর জন্য সহজভাবে ব্যাখ্যা করা হয়েছে।

Recursive Fibonacci Explained

কীভাবে Nth Fibonacci বের করা, recursion কাজ করার প্রক্রিয়া, এবং পুরো Fibonacci series তৈরি করা step by step। Recursive Factorial int fibonacci(int n){ if (n==0 || n ==1 ) return n; else return fibonacci(n-1) +fibonacci(n-2); } How it works When n is 4,