# Advanced C Tutorial

## String To Integer and Integer to String Conversion in C

String To Integer and Integer to String Conversion in C In modern languages like Java, C# etc., there is a provision of function to handle String to Integer and Integer to String conversion. But in case of C, you should explicitly convert. String to Integer Conversion String is a array …

## Fastest way of calculating Prime Number with less system overhead with C code

Fastest way of calculating Prime Number with less system overhead with C code. A number is said to be a prime number if it is divisible only by 1 and  the number itself. That is prime number is divisible by exactly two numbers. For example, 11 is prime number because …

## Subtraction of two binary numbers using C

Subtraction of two binary numbers using C Basic Theory Subtraction can be regarded as addition. For example A – B is same as A + (-B). In binary most computer uses 2’s complement form to represent negative binary number. The subtrahend is first converted to 2’s complement form to make …

## Addition of two binary numbers using C

Addition of two binary numbers using C Basic Theory Addition of binary numbers is far simpler than that of decimal number. This is because, binary addition includes addition between 1 and 0 only. The addition process results into two unit: sum and carry sum = a xor b xor c …

## Finding 1s Complement of a Binary Number is C

Finding 1’s Complement of a Binary Number is C The one;s complement operator (~) is a unary operator that causes the bits of its operand to be inverted ( i. e. reversed) so that 1s becomes 0s and 0s becomes 1s. This operator always precedes its operand, The operand must …

## SetPixel function on windowsh How to use it

SetPixel() function on windows.h . How to use it?? windows.h provides a function SetPixel() to print a pixel at specified location of a window. The general form of the function is SetPixel(HDC hdc, int x, int y, COLORREF& color); .csharpcode, .csharpcode pre{ font-size: small; color: black; font-family: consolas, “Courier New”, …

## How to do Multithreading using C/C++

Multithreading is necessary for those programs which need to run two or more processes within a single program simultaneously. For example: when you play a game( say Mario)  in a computer, then you see two or more enemies are moving at the same time  or in case of Football game …

## How to move console from one position to another using C

How to move console from one position to another using C provides a function MoveWindow() to move the console from one position to another. It requires 6 parameters. The source code is given below. #include #include HWND WINAPI GetConsoleWindowNT() { // declare function pointer type typedef HWND WINAPI (*GetConsoleWindowT)(void); // …

## How to resize the console window using C

How to resize the console window using C The code for resizing the console window is given below #include #include #include HANDLE wHnd; // Handle to write to the console. HANDLE rHnd; // Handle to read from the console. int main(int argc, char* argv[]) { // Set up the handles …

## How to make a digital clock using C

How to make a digital clock using C The following code creates a digital clock using a 1 sec. delay. provides various functions to delay the time. Source Code: #include #include #include COORD coord = {0, 0}; void gotoxy (int x, int y) { coord.X = x; coord.Y = y; …

## How to open website using C

How to open website using C You can easily open your website using C. You can pass the your website url as argument. When you run the code, this will open the url in browser. The code is very simple. You have to include or to use it. #include int …

## How to change the text color of console using C

How to change the text color of console using C The following code changes the text color of console to the color defined by color value supplied. You must include to use this function. It works on windows only. #include #include #include void SetColor(int ForgC) { WORD wColor; HANDLE hStdOut …

## How to change Background and Foreground color of Console in C

How to change Background and Foreground color of Console in C provides various functions to change the properties of windows like changing color, resizing windows, changing cursor position etc. The source code for changing the background and foreground color of console is given below. You can pass different color values …