SIP – Headers

sip header

SIP – Headers A header is a component of a SIP message that conveys information about the message. It is structured as a sequence of header fields. SIP header fields in most cases follow the same rules as HTTP header fields. Header fields are defined as Header: field, where Header is used to represent the header … Read more

C program to Change the Text Background Color

C program to Change the Text Background Color

C program to Change the Text Background Color Few important points regarding this program are: SetConsoleTextAttribute: Sets the attributes of characters written to the console screen buffer by the WriteFile or WriteConsole function, or echoed by the ReadFile or ReadConsole function. This function affects text written after the function call. Syntax: BOOL WINAPI SetConsoleTextAttribute(_In_ HANDLE hConsoleOutput , _In_ WORD wAttributes); Below is the … Read more

C Program to create a Menu Driven software using Switch Case

switch case flow chart

C Program to create a Menu Driven software using Switch Case #include<stdio.h> int main() { printf(“\n\n\t\tMenu driven program in c\n\n\n”); int choice, num, i; unsigned long int fact; while(1) { printf(“1. Factorial \n”); printf(“2. Prime\n”); printf(“3. Odd\\Even\n”); printf(“4. Exit\n\n\n”); printf(“Enter your choice : “); scanf(“%d”,&choice); switch(choice) { case 1: printf(“Enter number:\n”); scanf(“%d”, &num); fact = … Read more

C Program to Shutdown Linux OS

shutdown program in c

C Program to Shutdown Linux OS In this program : You need to be logged in as user for above program to execute otherwise you will get the message shutdown: “Need to be root”. ‘-P’ option specifies you want to power off your machine. You can specify minutes as: shutdown -P “number of minutes” Let see the below program #include<stdio.h> #include<stdlib.h> … Read more

C Program to shutdown Windows 7

shutdown program in c

C Program to shutdown Windows 7 This program turns off i.e shutdown your computer system. System function of stdlib.h is used to run an executable file shutdown.exe which is present in C:\WINDOWS\system32 folder in Windows 7 and XP #include<stdio.h> #include<stdlib.h> // to use system() method int main() { printf(“\n\n\t\tEduguru Shutdown program in c\n\n\n”); char ch; printf(“Do you want to … Read more

Basic Program of Pointer

understanding c pointers

Basic Program of Pointer #include <stdio.h> int main() { printf(“\n\n\t\tEduguru – Pointer program\n\n\n”); int var = 24; // actual variable declaration int *p; p = &var; // storing address of int variable var in pointer p printf(“\n\nAddress of var variable is: %x \n\n”, &var); // address stored in pointer variable printf(“\n\nAddress stored in pointer variable … Read more

The First Windows Program in C

The First Windows Program in C

The First Windows Program in C To keep things simple we would begin with a program that merely displays a “Hello” message in a message box. Here is the program… #include <windows.h> int _stdcall WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdline, int nCmdShow ) { MessageBox ( 0, “Hello!”, “Title”, 0 ) ; return … Read more

C program to print pascal triangle

C program to print pascal triangle #include <stdio.h> long factorial(int); int main() { int i, n, c; printf(“Enter the number of rows you wish to see in pascal triangle\n”); scanf(“%d”,&n); for (i = 0; i < n; i++) { for (c = 0; c <= (n – i – 2); c++) printf(” “); for (c = 0 ; c <= i; c++) printf(“%ld “,factorial(i)/(factorial(c)*factorial(i-c))); printf(“\n”); } return 0; } long factorial(int n) { int c; long result = 1; for (c = 1; c <= n; c++) result = result*c; return result; }

Compare two integers in C

Selection-sort-step to compare

Compare two integers in C Algorithm Let’s first see what should be the step-by-step procedure to compare two integers− START Step 1 → Take two integer variables, say A & B Step 2 → Assign values to variables Step 3 → Compare variables if A is greater than B Step 4 → If true print … Read more

C program for matrix addition

matrix program in c

C program for matrix addition #include <stdio.h> int main() { int a, b, c, d; int m1[10][10], m2[10][10], sum[10][10]; printf(“Please enter the number of rows of matrix\n”); scanf(“%d”, &a); printf(“Please enter number of columns of matrix\n”); scanf(“%d”, &b); printf(“Please enter the elements of first matrix one by one\n”); for ( c = 0 ; c … Read more