C Program to Input Password for Validation of User name

How to Input Password in C ? [crayon-5f81779281fcf937283256/] Output : [crayon-5f81779281fd7719778226/]Explain ? [crayon-5f81779281fda700850541/]Accept Character without Echo [ without displaying on Screen ] getch will accept character and store it in "ch"[crayon-5f81779281fdd866331152/]ASCII Value of "Enter Key" is 13 Stop Accepting Password Characters after "Enter" Key.[crayon-5f81779281fe0046584878/]ASCII Value of "BACKSPACE" is 8 After hitting "backspace"following actions should be carried out -Cursor Should be moved 1 character back. Overwrite that character by "NULL". After Writing NULL again cursor is moved 1 character ahead so again move cursor 1 character back . Decrement Current [...]

C Program to Write inline assembly language code in C Program

Add Two Numbers Using Inline Assembly Language ??? [crayon-5f81779282802583491364/]Assembly Language can be Written in C . C Supports Assembly as well as Higher Language Features so called "Middle Level Language". As shown in above Program , "asm" Keyword is written to indicate that "next followed instruction is from Assembly Language".[crayon-5f81779282809671020819/]Opening Curly brace after "asm" keyword tells that it is the "Start of Multiple Line Assembly Statements"  i.e "We want to Write Multiple Instructions" Above Program Without "Opening and Closing Brace" can be written [...]

C Program to Accept Paragraph using scanf

Accept Paragraph using scanf in C [crayon-5f81779282c04051163919/]Output :[Press Tab to Stop Accepting Characters ] [crayon-5f81779282c0b651011795/]How ? [crayon-5f81779282c0f150715496/]Here scanf will accept Characters entered with spaces. It also accepts the Words , new line characters . %[^\t]s  represent that all characters are accepted except tab(t) , whenever t will encountered then the process of accepting characters will be terminated.Drawbacks :Paragraph Size cannot be estimated at Compile Time It’s vulnerable to buffer overflows.How to Specify Maximum Size to Avoid Overflow ? [crayon-5f81779282c15227328344/]Output : [crayon-5f81779282c1b690049388/] Download PDF : Click Here

C Program to Print Hello word without using semicolon

Part 1 : Printf Hello word in C without using semicolon [only ones ][crayon-5f81779283032282622727/]Output : [crayon-5f81779283038157885159/]Part 2 : Printf Hello word in C without using semicolon [infinite times][crayon-5f8177928303c728227143/]Part 3 : Printf Hello [Using Switch][crayon-5f8177928303f380278386/]Part 4 : Using Else-if Ladder[crayon-5f81779283042918013334/]Part 5 : Printf Hello [Using While and Not][crayon-5f81779283045524039695/]Part 6 : Using #define[crayon-5f81779283047980757448/]

C Program to Demonstrate Nested Printf Statements

nested Printf statements : Example 1 [crayon-5f8177928347b114086312/]Output : [crayon-5f81779283482956135650/] How ?"abcdefghijklmnopqrstuvwxyz" will be first Printed while executing inner printf Total Length of the "abcdefghijklmnopqrstuvwxyz" is 26 So printf will return total length of string It returns 26 to outer printf This outer printf will print 26

C Program to Demonstrate Printf inside Another Printf Statement

Printf inside printf in C : Example 1 [crayon-5f81779283829976848675/] Output : [crayon-5f81779283831696140410/]How ?Firstly Inner printf is executed which results in printing 1324  This Printf Returns total number of Digits i.e  4 and second inner printf will looks like [crayon-5f81779283834676966220/]It prints 4 and Returns the total number of digits i.e 1 (4 is single digit number ) [crayon-5f81779283837936824367/]It prints simply 1 and output will looks like 132441Rule : Inner printf returns Length of string printed on screen to the outer printf

C Program to Reverse the digits of a number in 3 Steps

C program to reverse the digits of a number ? [ In 3 Steps ] Problem Statement : Reversing the digits of number without using mod (%) Operator ?Prerequisite :Atoi function Sprintf function[crayon-5f81779283f9b765296601/] Output : [crayon-5f81779283fa2811195663/] Explain Logic : Step 1 : Store Number in the Form of StringSprintf function sends formatted output to string variable specified Number will be stored in String variable "str"[crayon-5f81779283fa5171354316/] Step 2 : Reverse the String Using Strrev FunctionStrrev will reverse String eg "1234" will be reversed as "4321"[crayon-5f81779283fab736638445/] Step 3 : Convert [...]

C Program to Add digits of the number using single statement

Add Digits of the Number Using Single Statement : [crayon-5f81779284375385411170/] Output : [crayon-5f8177928437c975821466/] How ? [crayon-5f8177928437f047686686/]In 'For Loop' Condition is first tested and then body is executed. Carefully Look at Semicolon at the end of 'For Loop' , which tells us two Things -For Loop is Bodyless. Only Condition and Increment Statements will be executed.

C Program to Add two numbers without using arithmetic Operators

Way 1 : Using Recursive Function [crayon-5f81779284713002954413/]Way 2 : Using While Loop [crayon-5f81779284719864310073/]Way 3 : Using While Loop [crayon-5f8177928471d861653618/]Way 4 : Using For Loop [crayon-5f81779284720301271806/]Way 5 : Using Subtraction [crayon-5f81779284723267326166/] Note : This Example have Arithmetic Operator [-] but this example is for "Adding two numbers without using + Operator "

C Program to Create Your Own Header File in C Programming

Make Your Own Header File ?Step1 : Type this Code  [crayon-5f81779284afb013751162/]In this Code write only function definition as you write in General C ProgramStep 2 : Save CodeSave Above Code with [.h ] Extension . Let name of our header file be myhead [ myhead.h ] Compile Code if required.Step 3 : Write Main Program [crayon-5f81779284b02631317598/]Include Our New Header File . Instead of writing < myhead.h> use this terminology "myhead.h" All the Functions defined in the myhead.h header file are now ready for use . Directly  [...]

C Program to Write C Program Without using Main Function in 3 ways

Run C Program Without Main Function Conceptually C Program is meaningless without main Function . Every Program Must have Main Function. Main Function :It is Entry Point of Every C Program. All Predefined and User-defined Functions are called directly or indirectly through the main. So C Program Must have Main Function.But I have decided not to write main and want to run C Program , How ? We have 3 approaches of Writing C Program without using main().Way 1 : Using #define Preprocessor Directive [crayon-5f81779284e5c275977490/] What [...]

C Program to Return Multiple Values From a Function

Method 1 : Using Array If more than two variables of same type is to be returned then we can use array .Store each and every value to be returned in an array and return base address of that array.Method 2 : Using Pointer and One Return StatementPointer Variable can updated directly using  Value at ['*'] Operator.Usually Function can return single value.If we need to return more than two variables then update 1 variable directly using pointer and return [...]

C Program to Demonstrate use of Interrupts in C Programming

Power of Interrupts :Interrupts are messages to the Pentium chip to halt it current activity, and perform our requested job. We can almost do anything using interrupts without using functions. Note below example - we haven't used printf() still we are able to print message on screen.Live Program : [crayon-5f81779285541300556667/] Output: [crayon-5f81779285547836949827/]Explanation of Program : [crayon-5f8177928554a296461877/]dos.h header file contain geninterrupt() function which is  used to create interrupt. geninterrupt(0x21) is used to generate 0x21 interrupt. Note that the sentence is ended with a ‘$’ which is a terminating [...]

C Program to Print 1-10 numbers without using Conditional Loops

Print 1-10 numbers without using Conditional Loop i.e without usingfor Loop while Loop do-while LoopThis can be achieved in 3 ways :Using Printf Statement 10 Times. Using Recursive Function Using goto Statement. Recursive Main FunctionWay 1 : Printf Statement 10 times [crayon-5f817792859b5505185219/]Use 10 Times Printf Statement .Way 2 : Recursive Function [crayon-5f817792859c0213242967/]Recursive function : Calling Itself . printNumber function calls itself so it is called Recursive function .Way 3 : Using Goto Statement [crayon-5f817792859c7879823821/]Way 4 : Using Recursive Main [crayon-5f817792859cd088662488/]Static variable inside a function means "once the variable [...]