Posts

Unformatted Console I/O function

Unformatted Console i/o Function The unformatted console input and output function can deal with a single character and a string of characters. Normally we use the scanf() function for input but when we use the scanf() function we need to do one thing that is pressing the enter key to evaluate the success full input. Its weakness of scanf() Function. Now to read a single character we have a function called getch() and getche(), these functions not need to press the enter key because these functions return the character that most recently typed. The getche() function echoes the characters that you typed to the screen 'e' in getche() is referred for echos. getch() just return the characters that typed without echoing iron screen. getchar() is read a single character from the standard input stream and return the corresponding integer value ( it typically ASCII value of reading character) on success. It returns EOF (End of file) on failure. It is the same as getche() but requi...

Console I/O Functions

View this gist on GitHub Input/output The information we put into a computer is called input and the information we're given from the computer is called output. There is no keyword available in c for doing input/output or I/O, all I/o in c is done by using standard library function. there are several function library is available for performing input/output. I/O library function can be classified into two broad categories 1). Console I/O functions Function to receive input from the keyboard and write output usually on the computer screen. 2). File I/O function Function to perform I/O operations on a hard disk. Here we are going to discussing on console i/o function only. The file i/o functions would be discussed in other computer. Console I/O Functions As we discuss above function to receive input from keyboard and write output on screen. The screen and keyboard together called a console. Console I/O function can be further classified into two categories formatted and unformatted c...

Int data type

Int data type int (1 sign bit + 31 data bits) keyword in C. it is used to define any positive or negative integer. According to Min, the size of int is 4 bytes which is equal to 32 bits 1 byte = 8 bits Integer is not int integer is a very very category of numbers whereas one 'int' has limited and exact amount of memory to store what is being represented by it. An int type variable in C is able to store only numbers till 2147483647. Int is a 32-bit data type when never a number is being assigned to an int type variable it is first converted to its binary representation (that is in 0's and 1's) that it is kept in memory at a specific location. An int is actually 1 sign bit + 31 data bits, that 31 bits are available for storing the number. 1 bit is represented for maintaining the sign of the number which is either + or - sign is also represented by binary digits 0-> +, 1-> - int num= 2147483647 will be converted in binary =11111111111111111111111111111111 31 digits a...

Size of Operator in C

Size of the operator in C Size of is simply returns the amount of memory allocated to data type or variable. It is a compiler time unary operator. It can be applied to any data type like integer type, float type, pointer, and also to arrays and structure. The output depended on your machines, different machines have different output of the same data type. Example: #include<stdio.h> int main() { int a=1; double b=12.5; printf("Size of char is %lu", sizeof(char)); printf("Size of int is %lu", sizeof(int)); printf("Size of float is %lu", sizeof(float)); printf("Size of double is %lu", sizeof(double)); printf("Size of a+b is %lu", sizeof(a+b)); return 0; } Output: Size of char is 1 Size of int is 2 Size of float is 4 Size of double is 8 Size of double is 8   The size of the operator also use to find the length of the array and allocate a block of memory. Example  to finding number of element in array #include<stdio.h> int main()...

Operator in C

Operators are foundation any programming language. The functionally C programming language is incomplete without the use of the operator. Operators are symbols that help us to perform specific mathematical and logical computations on the operator. Operator Symbol Operator Name Operator Type ++, -- Unary operator unary operator +, -, *, /, % Arithmetic operator Binary operator <, <=, >, >=, ==, != Relational operator Binary operator &&, ||, ! Logical operator Binary operator &, |, <<, >>, ~, ^ Bitwise operator Binary operator =, +=, -=, *=, /=, %= Assignment operator Binary operator ? : Ternary operator Ternary operator Unary operator: operator that o...

Keyword in C

Keyword in C Keywords are specific reserved words in C. Every keyword was a specific feature associated with it. Almost all of the words which help us to use the Functionality of the C language. There are a total of 32 keywords in C. int for auto enum float while void volatile char do signed return long break unsigned sizeof double continue static struct switch register union default exten if const else volatile case short goto Most of these keyword have already known to you and we discussed in the various parts of C like Datatype, storage, classes, control statement, and functions.

Identifier

Identifier An identifier is a string of alphanumeric characters that begin with an alphabetic character or underscore character that are used to represent various programming elements such as variable, Functions, array, structure, unions and so on. An identifier is a user-defined word. Also remember identifiers must be unique. They are created to give a unique name to an entity to identify it during the execution of the program and the identifier name must be different from the keyword. Rules for naming identifiers. An identifier can have letters both uppercase and lowercase letters, digit, and underscores. The first letter of an identifier should be a letter or an underscore. You can not use the keyword as an identifier. Identifier names must be unique. Example of identifier. int sum; float average; function name void sum_of_twonumber(); void _student(); int main() { int a=99 printf("%d",a); } Above program has two identifiers. main as a function n...

enum in C

Enumeration in C Enumeration (or enum) is a user-defined data type in C. It is mainly used to assign names to integer constants, the names make a program easy to read and maintain. The keyword enum is used to declare an enumeration syntax of enum.     enum enum_name {cons1, cons2, ... }; The enum keyword is also used to define the variable of the enum type. There are two ways to define the variables of enum types as follows. Declaration: enum  week {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday}; enum week day;           //initialization Now in the above declaration Monday is assigned to 0, Tuesday is assigned to 1, Wednesday to 2, and so on at the and Sunday is assigned to 6. Compiler By default assigns values starting from 0. Example  to understand the working of enum in C. #include<stdio.h> enum week {Mon, Tue, Wed, Thus, Fri, Sat, Sun}; int main() { enum week day; day=Fri; printf("%d", day); return 0; } Output: 4 In above ex...

Projections Of Line Most Important Diagram

Image
Projections Of Line Most Important Diagram The most important diagram showing graphical relations among all important parameters of this topic. Study and memorize it. And use in solving various problems. True length (TL)-a'b,'& ab Angle of TL with hp- θ Angle of TL with VP- Ø Angle of FV with XY- α Angle of TV with XY - β  LTV (length of FV)-component (a-1) LFV (length of TV)- component (a'-1') Position of A- distances of a & a' from XY Position of B-distances of b & b' from XY Distance between end projectors Note this θ & α construct with a' Ø & β construct with a b' & b 1 '  on the locus. b & b 1  on the same locus. also remember True length is never rotated. its horizontal component is drawn & it is further rotated to locate the view. Views are always rotated, made horizontal & further extended to locate TL,θ & Ø Please write comments if you find anything incorrect and if you h...

Problems On Isometric Projections

Image
Problems On Isometric Projections 1 ] Projections of frustum of the pentagonal pyramid are given, draw it's isometric view. Solution Steps: First draw isometric of its base. Then draw the same shape as a top, 60mm above the base pentagon center. Then reduce the top to 20mm sides and join with the proper base corners. 2 ] Projections of a frustum of the cone is given, draw it's isometric view. Solution Steps: First draw isometric of its base. Then draw the same shape as a top, 60mm above the base pentagon center. Then reduce the top to 20mm sides and join with the proper base corners. 3 ] A square pyramid of 30mm base sides and 50mm long axis, is centrally placed on the top of a cube of 50mm long edged. Draw the isometric view of the pair. 4 ] A triangular pyramid of 30 mm base sides and 50 mm long axis, is centrally placed on the top of a cub of 50 mm long edges. Draw the isometric view of the pair.  Solution steps To draw isometric of a cube is simple. dra...