Posts

C Programming Tutorials – Complete Guide from Basics to Advanced

Welcome to C Tutorials MP , a learning resource for students who want to learn C programming step by step. Explore the topics below, read the explanations, practise programs, and strengthen your programming fundamentals. How to use this guide: Start with Section 1 and continue in order. Click any topic to open its dedicated tutorial. We will keep this index updated as more lessons are added. 1. Introduction to C Programming Introduction to C Programming History and Features of C Applications and Advantages of C Structure of a C Program Writing and Executing Your First C Program Compiler, Interpreter and IDE 2. Tokens, Variables and Data Types Tokens in C Keywords and Identifiers Variables and Constants Data Types in C Declaration and Initialization of Variables Type Conversion and Type Casting 3. Input, Output and Operators printf() and scanf() Functions Operators in C Arithmetic and Relational Operators Logical and Assignment Operators Increment and Decrement Operators Operator Prece...

C Program to Store and Display Records of N Students Using Union (यूनियन का उपयोग करके N स्टूडेंट्स के रिकार्ड्स स्टोर और डिस्प्ले करना)

In C language, an array of unions can be used to store multiple values using a common memory area. In this program, a union is used to store and display the names of 10 students. C Language में Multiple Values को एक Common Memory Area में Store करने के लिए Array of Unions का उपयोग किया जा सकता है। इस Program में Union की सहायता से 10 Students के Names Store और Display किए गए हैं। C Program #include <stdio.h> #include <string.h> #define N 10 union student { int rollno; char name[20]; char gender; float fees; }; int main() { int i; union student s[N]; // Input student names for (i = 0; i < N; i++) { printf("Enter name of student %d: ", i + 1); fgets(s[i].name, sizeof(s[i].name), stdin); s[i].name[strcspn(s[i].name, "\n")] = '\0'; } // Display student names printf("\n========== STUDENT NAMES ==========\n"); for (i = 0; i < N; i++) { printf("N...

C Program to Store and Display Records of N Products Using Structure (स्ट्रक्चर का उपयोग करके N प्रोडक्ट्स के रिकार्ड्स स्टोर और डिस्प्ले करना)

In C language, an array of structures is used to store and display records of multiple products. Each product record contains product ID, product name, manufacturing date, supplier name and price. C Language में Multiple Products के Records को Store और Display करने के लिए Array of Structures का उपयोग किया जाता है। प्रत्येक Product के Record में Product ID, Product Name, Manufacturing Date, Supplier Name और Price शामिल होते हैं। C Program #include <stdio.h> #include <string.h> #define N 10 struct product { int pid; char pname[20]; char mfd[11]; char sname[20]; float price; }; int main() { int i; struct product p[N]; // Input product records for (i = 0; i < N; i++) { printf("\nEnter details of Product %d:\n", i + 1); printf("Enter product ID: "); scanf("%d", &p[i].pid); getchar(); printf("Enter product name: "); fgets(p[i].pname, sizeof(p[i].p...

C Program to Store and Display Records of N Employees Using Structure (स्ट्रक्चर का उपयोग करके N एम्प्लोयी के रिकार्ड्स स्टोर और डिस्प्ले करना)

In C language, an array of structures is used to store and manage records of multiple employees. Each employee record contains employee ID, name, designation, address, mobile number, gender and salary. C Language में Multiple Employees के Records को Store और Manage करने के लिए Array of Structures का उपयोग किया जाता है। प्रत्येक Employee के Record में ID, Name, Designation, Address, Mobile Number, Gender और Salary शामिल होते हैं। C Program #include <stdio.h> #include <string.h> #define N 10 struct employee { int eid; char ename[20]; char des[20]; char add[50]; char mobile[14]; char gender; float salary; }; int main() { int i; struct employee emp[N]; // Input employee records for (i = 0; i < N; i++) { printf("\nEnter details of Employee %d:\n", i + 1); printf("Enter employee ID: "); scanf("%d", &emp[i].eid); getchar(); printf("Enter employee name: ...

C Program to Store and Display Records of N Students Using Structure (स्ट्रक्चर का उपयोग करके N स्टूडेंट्स केरिकार्ड्स स्टोर और डिस्प्ले करना)

In C language, an array of structures is used to store records of multiple students. Each array element represents one student and contains roll number, name, gender and fees. C Language में Multiple Students के Records को Store करने के लिए Array of Structures का उपयोग किया जाता है। प्रत्येक Array Element एक Student की जानकारी जैसे Roll Number, Name, Gender और Fees को Store करता है। C Program #include <stdio.h> #include <string.h> #define N 10 struct student { int rollno; char name[20]; char gender; float fees; }; int main() { int i; struct student s[N]; // Input student records for (i = 0; i < N; i++) { printf("\nEnter details of student %d:\n", i + 1); printf("Enter roll number: "); scanf("%d", &s[i].rollno); getchar(); // Remove newline printf("Enter student name: "); fgets(s[i].name, sizeof(s[i].name), stdin); s[i].name[strcspn(s[i]...

C Program to Check Whether a String is Palindrome or Not ? (String Palindrome Program in C Language)

A palindrome string is a string that reads the same forward and backward. For example, MADAM , LEVEL and RADAR are palindrome strings. A string that does not read the same forward and backward is called a non-palindrome string. Palindrome String वह String होती है जो आगे और पीछे दोनों तरफ से पढ़ने पर समान होती है। उदाहरण के लिए MADAM , LEVEL और RADAR Palindrome Strings हैं। C Program #include <stdio.h> #include <string.h> int main() { char a[100], b[100]; int i; printf("Enter a string: "); fgets(a, sizeof(a), stdin); a[strcspn(a, "\n")] = '\0'; strcpy(b, a); // Reverse the copied string for (i = 0; b[i] != '\0'; i++) { // Find string length } for (int j = 0, k = i - 1; j < k; j++, k--) { char temp = b[j]; b[j] = b[k]; b[k] = temp; } if (strcmp(a, b) == 0) printf("%s is a palindrome string.", a); else printf("%s ...

Union of Structure in C Language (C Language में Union of Structure)

Definition A union that contains a structure variable as one of its data members is called a Union of Structure . In C language, a structure can be declared as a member of a union. In the following example, course is a union that contains a structure variable s of type struct student as one of its members. जिस Union में Structure Type के Variable को Data Member के रूप में Declare किया जाता है, उसे Union of Structure कहते हैं। C Language में किसी Structure को Union के Member के रूप में Declare किया जा सकता है। निम्न उदाहरण में course नामक Union में struct student Type का Variable s एक Member के रूप में Declare किया गया है। Example struct student { int roll_no; char name[20]; char gender; float fees; }; union course { int courseid; char course_name[20]; struct student s; int strength; }; union course c; Explanation In the above example: student is a structure containing four members: roll_no , name , gender and fees . course is a union containing...

toupper() and tolower() Functions in C Language (C Language में toupper() और tolower() Functions)

 1. toupper() Function The toupper() function is used to convert a lowercase alphabet into an uppercase alphabet. It is declared in the <ctype.h> header file. toupper() फंक्शन का उपयोग छोटे अक्षर (Lowercase) को बड़े अक्षर (Uppercase) में बदलने के लिए किया जाता है। यह <ctype.h> Header File में Defined है। Syntax: toupper(character); Example: char ch = 'a'; printf("%c", toupper(ch)); Output: A C Program Using toupper() #include <stdio.h> #include <ctype.h> int main() { char ch; printf("Enter a character: "); scanf("%c", &ch); printf("Uppercase character: %c", toupper((unsigned char)ch)); return 0; } Output: Enter a character: a Uppercase character: A 2. tolower() Function The tolower() function is used to convert an uppercase alphabet into a lowercase alphabet. It is also declared in the <ctype.h> header file. tolower() फंक्शन का उपयोग बड़े अक्षर (Uppercase) को छोटे अक्षर (Lowerca...