The C language gives 5 ways to create a custom datatype:
  1. The Structure, which is a group of variables under one name and is called an aggregate datatype.
  2. The union, which enables the same piece of memory to be defined as two or more different types of variables.
  3. The bit-field, which is special type of structure or union element that allows easy access to individual bits.
  4. The enumeration, which is a list of named integer constants.
  5. The typedef keyword, which defines a new name for an existing type.
Structures: A structure is a collection of variables referenced under one name, providing a convenient means of keeping related information together. The structure declaration forms a template that can be used to create structure objects (i.e., instances of a structure). These variables are called members of that structure or structure members.
The general form of structure declaration is as follows
                                struct tag
                                 {
                                   type member_name;
                                   type member_name;
                                   ...
                                   ...
                                 }structure_variables;
The keyword 'struct' is used to declare a structure.
eg.,                             struct addr
{
char name[30];
char street[40];
char city[20];
char state[10];
unsigned long int zip;
};
Notice that the declaration is terminated by a semicolon. This is because a structure declaration also a statement. Also, the structure tag addr identifies this particular data structure and is its type specifier.
In the above example, no variable has been declared or created. Only the form of data been defined.
If you want to declare a variable for this structure, then write as:
struct addr sinfo;
When a structure variable is declared, the compiler automatically allocates sufficient memory to accommodate all of its members.
You can also declare one or more objects when you declare a structure. For example,
struct addr
{
char name[30];
char street[40];
char city[20];
char state[10];
unsigned long int zip;
}sinfo,ainfo;
Note: If you only need one structure variable, then there is no need of structure tag.
Accessing Structure members: Individual members of a structure are accessed through the use of '.'(dot) operator.
For example, the following statement assign the zip code to the zip field of the structure variable 'sinfo' declared earlier:
sinfo.zip=533214;
The general form of accessing a member of structure is,
                                     object_name.member_name;
In the above example, we are initialized directly we also be able to initialized the value to a structure field at run time as follows:
                                     scanf("%lu",&sinfo.zip);
Therefore, to print the name on the screen, write
printf("%lu",sinfo.zip);
Since name is a character array, you can access the individual characters of sinfo.name by indexing name. For example, you can print the contents of the sinfo.name one character at a time by using the following code:
for(i=0;sinfo.name[i];i++)
{
printf("%c",sinfo.name[i]);
}
Structure Assignment: The information contained in one structure can be assigned to another structure of the same type using a single assignment statement.
//Example Program for Structure Assignment
#include<stdio.h>
struct
{
int a,b;
}var1,var2;
main()
{
var1.a=929;    //assigning a value to the variable a through structure variable var1
var2=x;           //assigning one structure variable to another
printf("%d\t%d",var1.a,var2.b);
}
Arrays of Structures: Structures are often arrayed. To declare an array of structures, you must first define a structure and then declare an array variable of that type. For example, to declare a 100- element array of structures of type addr defined earlier, write
struct addr sinfo[100];
To access a specific structure, index the array name. For example, to print the zip code of structure 3, write
printf("%ul",sinfo[2].zip);
Like all array variable, arrays of structures begin indexing at 0. Let us see the following code,
struct addr
{
char name[30];
char street[40];
char city[20];
char statte[10];
unsigned long int zip;
}sinfo[100];
Passing Structures to Functions: In this topic we discuss about
1) How a structure member passed to a function?
2) How a structure passed to a function?
1)  Passing Structure member to a function: When you pass a member of a structure to a function, you are passing the value of that member to the function. For example,
consider,
struct funst
{
char x;
int y;
float z;
char s[10];
}var1;
Here are some examples of each member being passed to a function:
fun1(var1.x);           //passes character value of x
fun2(var1.y);            //passes integer value of y
fun3(var1.z);           //passes float value of z
fun4(var1.s);            //passes address of string s
fun5(var1.s[2]);       //passes character value of s[2]
In each case, it is the value of a specific element that is passed to the function. It does not matter that the element is part of a larger unit.
If you wish to pass the address of an individual structure member, put the & operator before the structure name. For example, to pass the address of the members of the structure mike, write,
fun1(&var1.x);
fun2(&var1.y);
fun3(&var1.z);
fun4(var1.s);
fun5(&var1.s[2]);
Note that & operator proceeds the structure name, not the individual name. Note also that s already signifies an address, so no & required.

Structures in C

Posted by Kalyan Kurasala  |  No comments

The C language gives 5 ways to create a custom datatype:
  1. The Structure, which is a group of variables under one name and is called an aggregate datatype.
  2. The union, which enables the same piece of memory to be defined as two or more different types of variables.
  3. The bit-field, which is special type of structure or union element that allows easy access to individual bits.
  4. The enumeration, which is a list of named integer constants.
  5. The typedef keyword, which defines a new name for an existing type.
Structures: A structure is a collection of variables referenced under one name, providing a convenient means of keeping related information together. The structure declaration forms a template that can be used to create structure objects (i.e., instances of a structure). These variables are called members of that structure or structure members.
The general form of structure declaration is as follows
                                struct tag
                                 {
                                   type member_name;
                                   type member_name;
                                   ...
                                   ...
                                 }structure_variables;
The keyword 'struct' is used to declare a structure.
eg.,                             struct addr
{
char name[30];
char street[40];
char city[20];
char state[10];
unsigned long int zip;
};
Notice that the declaration is terminated by a semicolon. This is because a structure declaration also a statement. Also, the structure tag addr identifies this particular data structure and is its type specifier.
In the above example, no variable has been declared or created. Only the form of data been defined.
If you want to declare a variable for this structure, then write as:
struct addr sinfo;
When a structure variable is declared, the compiler automatically allocates sufficient memory to accommodate all of its members.
You can also declare one or more objects when you declare a structure. For example,
struct addr
{
char name[30];
char street[40];
char city[20];
char state[10];
unsigned long int zip;
}sinfo,ainfo;
Note: If you only need one structure variable, then there is no need of structure tag.
Accessing Structure members: Individual members of a structure are accessed through the use of '.'(dot) operator.
For example, the following statement assign the zip code to the zip field of the structure variable 'sinfo' declared earlier:
sinfo.zip=533214;
The general form of accessing a member of structure is,
                                     object_name.member_name;
In the above example, we are initialized directly we also be able to initialized the value to a structure field at run time as follows:
                                     scanf("%lu",&sinfo.zip);
Therefore, to print the name on the screen, write
printf("%lu",sinfo.zip);
Since name is a character array, you can access the individual characters of sinfo.name by indexing name. For example, you can print the contents of the sinfo.name one character at a time by using the following code:
for(i=0;sinfo.name[i];i++)
{
printf("%c",sinfo.name[i]);
}
Structure Assignment: The information contained in one structure can be assigned to another structure of the same type using a single assignment statement.
//Example Program for Structure Assignment
#include<stdio.h>
struct
{
int a,b;
}var1,var2;
main()
{
var1.a=929;    //assigning a value to the variable a through structure variable var1
var2=x;           //assigning one structure variable to another
printf("%d\t%d",var1.a,var2.b);
}
Arrays of Structures: Structures are often arrayed. To declare an array of structures, you must first define a structure and then declare an array variable of that type. For example, to declare a 100- element array of structures of type addr defined earlier, write
struct addr sinfo[100];
To access a specific structure, index the array name. For example, to print the zip code of structure 3, write
printf("%ul",sinfo[2].zip);
Like all array variable, arrays of structures begin indexing at 0. Let us see the following code,
struct addr
{
char name[30];
char street[40];
char city[20];
char statte[10];
unsigned long int zip;
}sinfo[100];
Passing Structures to Functions: In this topic we discuss about
1) How a structure member passed to a function?
2) How a structure passed to a function?
1)  Passing Structure member to a function: When you pass a member of a structure to a function, you are passing the value of that member to the function. For example,
consider,
struct funst
{
char x;
int y;
float z;
char s[10];
}var1;
Here are some examples of each member being passed to a function:
fun1(var1.x);           //passes character value of x
fun2(var1.y);            //passes integer value of y
fun3(var1.z);           //passes float value of z
fun4(var1.s);            //passes address of string s
fun5(var1.s[2]);       //passes character value of s[2]
In each case, it is the value of a specific element that is passed to the function. It does not matter that the element is part of a larger unit.
If you wish to pass the address of an individual structure member, put the & operator before the structure name. For example, to pass the address of the members of the structure mike, write,
fun1(&var1.x);
fun2(&var1.y);
fun3(&var1.z);
fun4(var1.s);
fun5(&var1.s[2]);
Note that & operator proceeds the structure name, not the individual name. Note also that s already signifies an address, so no & required.

08:18 Share:

Introduction to Turboc2 Graphics:


                          Syntax: initgraph(int *graphicdriver,int *graphicmode,char *pathtodriver);
                 Here *graphicdriver, specifies Graphic Driver to be used. *graphicmode, specifies the initial Graphics Mode. *pathtodriver, specifies the directory path where initgraph() looks for graphics drivers.
       Once the driver has been loaded, initgraph() sets up the numeric values to the graphics mode.

                     
Graphics in C Programming

C Graphics

Posted by Kalyan Kurasala  |  No comments

Introduction to Turboc2 Graphics:


                          Syntax: initgraph(int *graphicdriver,int *graphicmode,char *pathtodriver);
                 Here *graphicdriver, specifies Graphic Driver to be used. *graphicmode, specifies the initial Graphics Mode. *pathtodriver, specifies the directory path where initgraph() looks for graphics drivers.
       Once the driver has been loaded, initgraph() sets up the numeric values to the graphics mode.

                     
Graphics in C Programming

08:16 Share:
In Computer Programming, C is a general-purpose programming language. It was developed by Dennis Ritche at AT&T Bell Labs in between 1969-1972 with his friend Ken-Thompson. C is a Structured Programming. In 1989, American National Standards Institute (ANSI) published a standard for C, is called C89.  In 1990, the same specification was proposed by ISO, is  alled C90. In 1999, ISO again released the Internationalization standards, is called C99. Now the current version of standard is known as C11, was proposed in 2011.
According to C89, we have 32 keyword in C language. Those are
auto            break            case             char            const
 continue     default          do                double        else
 enum          extern          float             for               goto
 if                  int                 long             register       return
 short           signed           sizeof          static           struct
 switch         typedef        union           unsigned    void
 volatile         while 
In C99, another 5 keywords are added. Those are
_Bool            _Complex            _Imaginary              inline             restrict
In C11, another 7 keywords are added. Those are
_Alignas            _Alingnof            _Atomic            _Generic


 _Noreturn        _Static_assert    _Thread_local
Keywords

Indroduction to C

Posted by Kalyan Kurasala  |  No comments

In Computer Programming, C is a general-purpose programming language. It was developed by Dennis Ritche at AT&T Bell Labs in between 1969-1972 with his friend Ken-Thompson. C is a Structured Programming. In 1989, American National Standards Institute (ANSI) published a standard for C, is called C89.  In 1990, the same specification was proposed by ISO, is  alled C90. In 1999, ISO again released the Internationalization standards, is called C99. Now the current version of standard is known as C11, was proposed in 2011.
According to C89, we have 32 keyword in C language. Those are
auto            break            case             char            const
 continue     default          do                double        else
 enum          extern          float             for               goto
 if                  int                 long             register       return
 short           signed           sizeof          static           struct
 switch         typedef        union           unsigned    void
 volatile         while 
In C99, another 5 keywords are added. Those are
_Bool            _Complex            _Imaginary              inline             restrict
In C11, another 7 keywords are added. Those are
_Alignas            _Alingnof            _Atomic            _Generic


 _Noreturn        _Static_assert    _Thread_local

08:12 Share:

Now You Can Play YouTube Videos in VLC

In-order to play YouTube videos in VLC follow the following steps.

1) Open VLC media player.

2) Press Ctrl+N. A dialog window will be open.

3) Enter the URL of YouTube video that you want to play in VLC.

4) Click on Play button.

YouTube Videos in VLC

Posted by Kalyan Kurasala  |  No comments

Now You Can Play YouTube Videos in VLC

In-order to play YouTube videos in VLC follow the following steps.

1) Open VLC media player.

2) Press Ctrl+N. A dialog window will be open.

3) Enter the URL of YouTube video that you want to play in VLC.

4) Click on Play button.

21:05 Share:
Java, is one of Programming Language, which follows Object-Oriented approach. Before using Java, C++ is most popular Object-Oriented Programming Language. This partially supports OOP concepts. Doesn't support Garbage Collection.It doesn't provide built-in support for threads. It doesn't support the portability etc.

But Java is a purly object-oriented programming language. Before going to know about the structure of Java Program, we should know about Object.

What is Object?
In general Object is a real time entity i.e., object is a real thing. It may be a pen, book, bike, computer or anything.

In Object-Oriented Programming an Object is a collection of memory , that has data fields and procedures. These data fields are also referred as instances and procedures are referred as methods. These Objects are the instances of classes.

What is a Class?
A class is a blueprint from which individual objects are created. A best example for class is as follows:

In the real world, you'll often find many individual objects all of the same kind. For example consider a car. There may be thousands of other cars in existence, all of the same manufacture and model. Each car was manufacture from the same set of blueprints and therefore contains the same components. In object-oriented terms, we say that your car is an instance of the class of objects known as cars. So, a class is the blueprint from which individual objects are created.

In Java a class can be defined by using the keyword class.

A simple Java Program Structure is:

access-specifier class classname {

//defining instance variables
datatype1 instance-variable1,instance-variable2,instance-variable3,...,instance-variablen;
datatype2 instance-variable1,instance-variable2,instance-variable3,...,instance-variablen;
...
datatypen instance-variable1,instance-variable2,instance-variable3,...,instance-variablen;

//defining methods

access-specifier return-type methodname(parameter-list) {

//method() code here
}
...
}

Here,

access-specifier: Java defines 3 types of access-specifiers.
1) public: We can access anywhere in the program.
2) private: We can access only local.
3) protected: It has different access permissions.

By default Java take every class, method and variable as public.

class: You already know class is a keyword to define a class.

classname: It is the name of the class. Which has some rules that is How to name a class?

A class name must not start with a number.
It must start with an alphabet or an underscore.
No special symbols are allowed. Only underscore is allowed.
No spaces are allowed.

A class name like Example1, Add, Sum etc.

In Java every pre-defined class name start with capital letter. Such as JFrame, JLabel etc.

datatype1, datatype2,...,datatypen are the predefined data types in Java such as int, float, char etc.

instance-variable1, instance-variable2,...,instance-variablen are the variablenames.

return-type: Every method of Java Program must have a return type. We have no need to declare a constructor method without any return type. The Java Programming Language consider the default return type for a constructor as void.

parameter-list: parameter-list is the values which we are passing to that method.

See the following Hello World Program:

                       class HelloWorld {
                                public static void main(String args[]) {
                               System.out.println("Hello World...!!!");
                            }
                        }

Here public static void main(String args[]) is the default syntax of main() method in Java and String args[] is the command-line arguments.


To execute above program, It is easy to save the any Java Program with it's main class name. For example, save the above program as HelloWorld.java
After saving your program, goto command prompt type javac HelloWorld.java to compile the Java Program.
If your program has no errors then type java HelloWorld
Then output for your program will display in next line.

See this video -- https://www.youtube.com/watch?v=iVTIHlS8rVM

Both in the structure and HelloWorld example I haven't shown How to access methods of one class with object. I will show that in further classes.

Java Programming Structure

Posted by Kalyan Kurasala  |  No comments

Java, is one of Programming Language, which follows Object-Oriented approach. Before using Java, C++ is most popular Object-Oriented Programming Language. This partially supports OOP concepts. Doesn't support Garbage Collection.It doesn't provide built-in support for threads. It doesn't support the portability etc.

But Java is a purly object-oriented programming language. Before going to know about the structure of Java Program, we should know about Object.

What is Object?
In general Object is a real time entity i.e., object is a real thing. It may be a pen, book, bike, computer or anything.

In Object-Oriented Programming an Object is a collection of memory , that has data fields and procedures. These data fields are also referred as instances and procedures are referred as methods. These Objects are the instances of classes.

What is a Class?
A class is a blueprint from which individual objects are created. A best example for class is as follows:

In the real world, you'll often find many individual objects all of the same kind. For example consider a car. There may be thousands of other cars in existence, all of the same manufacture and model. Each car was manufacture from the same set of blueprints and therefore contains the same components. In object-oriented terms, we say that your car is an instance of the class of objects known as cars. So, a class is the blueprint from which individual objects are created.

In Java a class can be defined by using the keyword class.

A simple Java Program Structure is:

access-specifier class classname {

//defining instance variables
datatype1 instance-variable1,instance-variable2,instance-variable3,...,instance-variablen;
datatype2 instance-variable1,instance-variable2,instance-variable3,...,instance-variablen;
...
datatypen instance-variable1,instance-variable2,instance-variable3,...,instance-variablen;

//defining methods

access-specifier return-type methodname(parameter-list) {

//method() code here
}
...
}

Here,

access-specifier: Java defines 3 types of access-specifiers.
1) public: We can access anywhere in the program.
2) private: We can access only local.
3) protected: It has different access permissions.

By default Java take every class, method and variable as public.

class: You already know class is a keyword to define a class.

classname: It is the name of the class. Which has some rules that is How to name a class?

A class name must not start with a number.
It must start with an alphabet or an underscore.
No special symbols are allowed. Only underscore is allowed.
No spaces are allowed.

A class name like Example1, Add, Sum etc.

In Java every pre-defined class name start with capital letter. Such as JFrame, JLabel etc.

datatype1, datatype2,...,datatypen are the predefined data types in Java such as int, float, char etc.

instance-variable1, instance-variable2,...,instance-variablen are the variablenames.

return-type: Every method of Java Program must have a return type. We have no need to declare a constructor method without any return type. The Java Programming Language consider the default return type for a constructor as void.

parameter-list: parameter-list is the values which we are passing to that method.

See the following Hello World Program:

                       class HelloWorld {
                                public static void main(String args[]) {
                               System.out.println("Hello World...!!!");
                            }
                        }

Here public static void main(String args[]) is the default syntax of main() method in Java and String args[] is the command-line arguments.


To execute above program, It is easy to save the any Java Program with it's main class name. For example, save the above program as HelloWorld.java
After saving your program, goto command prompt type javac HelloWorld.java to compile the Java Program.
If your program has no errors then type java HelloWorld
Then output for your program will display in next line.

See this video -- https://www.youtube.com/watch?v=iVTIHlS8rVM

Both in the structure and HelloWorld example I haven't shown How to access methods of one class with object. I will show that in further classes.

03:44 Share:

Computer: Computer is an Electronic device which is used to process the data, store the data and access the data. 
        Now a days computers are the part of humans life. Day by day the usage of computer also increasing. The computers are used in Registration Offices, Railway and Bus reservations, Bank transactions, Shopping malls, Schools, Colleges, Offices etc.
       Now a days, the computer education is necessary for every student. So, every Government and Private organizations are come together and offering different computer courses for students.
     
Posted by Kalyan Kurasala  |  No comments

Computer: Computer is an Electronic device which is used to process the data, store the data and access the data. 
        Now a days computers are the part of humans life. Day by day the usage of computer also increasing. The computers are used in Registration Offices, Railway and Bus reservations, Bank transactions, Shopping malls, Schools, Colleges, Offices etc.
       Now a days, the computer education is necessary for every student. So, every Government and Private organizations are come together and offering different computer courses for students.
     

08:21 Share:
HTML BASIC CONCEPTS...
Enjoy Learning...
HTML Basic Concepts

HTML

Posted by Kalyan Kurasala  |  1 comment

HTML BASIC CONCEPTS...
Enjoy Learning...

08:21 Share:
Get updates in your email box
Complete the form below, and we'll send you the best coupons.

Deliver via FeedBurner
back to top