Showing posts with label basics. Show all posts
Showing posts with label basics. Show all posts

Thursday, February 23, 2017

Structure Part I The Basics



Structure Part I The Basics


 

Today we are going to go through Structures from defining structures to using structures.
Structures are just a collection of different types under one roof (you can even put one type only!). So that means they give you flexibility of grouping different data types (like int, char, or even char[]) under one name.
So let us start with obviously defining a Structure. In `C` we declare a structure as simply as this:-
struct dob {
    int day;
    int month;
    int year;
};
1: In the above code segment struct is a keyword which defines structure.
2: Followed by struct keyword (dob) is the name of our structure.
3: Elements of struct are defined inside braces ‘{}’ as we did (int day; etc).
4: After ending brace we place a terminator ‘;’ to end the declaration.

So now you know how to define a structure but how to create its instances now?
To create a variable of our structure we just need to do this:
struct dob date;
This now declares date as a structure variable of type dob.
1: Here ‘struct dob’ is our above declared structure.
2: date is a variable of type dob.

So ok we have a structure and a variable of that type but how can i access its parts?
well we can access it and assign it so simply like this:-
date.day = 19;date.month = 10;date.year  = 1990;
Note here we use the dot (.) operator to access the fields (parts) of our structure.
ok everything looks nice so for but how in the world can i read data into this structure variable? Again no worries its again simple:-
scanf(“%d”, &date.day);scanf(“%d”, &date.month);
that was pretty easy but I was wondering how can i print its data?
Just do it like this:-
printf(“Day: %d”, date.day);printf(“Month: %d”,date.month);printf(“Year: %d”, date.year);
Again remember we use dot (.) operator to access members of a structure.
So we now know how to define and declare a structure, how to access its members, how to read data in it, and how to print data of a structure. Oh that was a tough job..!
Now let us put it together in a single C Program.
/***********************************************/
#include <stdio.h>
struct dob {
   int day;
   int month;
   int year;
};

int main(void) {
  struct dob date;
  date.day = 19;
  date.month = 10;
  date.year = 1990;

  printf(“Day is : %d, Month is: %d, and Year is %d ”,
           date.day,date.month, date.year);

  printf(“Enter Day, Month, and Year separated by spaces: “);
  scanf(“%d %d %d”, &date.day,&date.month,&date.year);
  printf(“Your entered Date is: %d/%d/%d”,
  date.day,date.month,date.year);

  return 0;
}
Output:
Day is : 19, Month is: 10, and Year is 1990
Enter Day, Month, and Year separated by spaces: 1 1 2014
Your entered Date is: 1/1/2014

Available link for download




Read more »

Thursday, October 6, 2016

The Basics of PC Utilities Software



The Basics of PC Utilities Software


PC system utilities are programs that encompass several applications that help clean up and fix numerous computer issues. While most PC utility software programs differ greatly in the services that they offer, there are several basic functions common to the majority of these programs.

Registry Fix:

Your registry is constantly changing with updates, new registry entries and deletion of old entries. Because of this, there are usually numerous entries in your registry that are very old, useless or corrupted, and these entries can create numerous errors. Your registry is a vital part of your computer, and it can easily be harmful to your computer to delete registry files that are necessary. Instead of trying to clean the registry manually, PC utilities software can scan and detect which files need to be removed and which files need to stay without harming your computer.

On the chance that the removal does damage your computer, there is usually the option to restore the registry to a backup file that was made before the cleaning process to return your computer to normal.

Junk File Cleaning:

Temporary files, cookies, recycle bin files and much more are all junk files that needlessly take up space in your computer. Not only does this rob you of hard drive space, but it may also significantly slow down your computer. A quick scan and sweep of the junk files can free up gigabytes of space and speed up your computer.

System Optimization:

You may not be using the best settings or options for your computing needs. System optimization tools can improve your Internet browsing, save laptop battery life, increase speed and more. You can also set the options to optimize performance for work related activities, gaming, typical home usage, server use and more.

Defragmentation:

As you add, change and delete files on your computer, these files fragment and spread out over your system. The more changes, additions and deletions are made, the more fragments are created. When too many fragments are created and when too many files are fragmented, it can slow down computer speed since it needs to find all of the fragments of a file in order to use it. Defragmentation software finds these fragments and puts them back together to create a more complete file allowing the computer to easily find and access the file.

Error Detection:

Though you may not always notice, your system may be dealing with errors that can be affecting performance or damaging files, programs or the entire system. Error detection finds and resolves errors found in your system. If it cant resolve the issue, it can usually provide the user with information on the error as a reference to fix it.

Why Do I Need PC Utility Software?

The Basics of PC Utilities Software

One of the most important times to get PC utility software is when you are dealing with a slow and problematic computer. A good utility software can remedy several problems that may be causing performance issues. Though a good utility software is a good start, its also a good idea to get a quality antivirus software to ensure that no viruses are causing the issue. Antivirus software will also provide constant virus protection to keep your computer safe from future infections.

PC utilities software is also beneficial for anyone who wants to regularly maintain their computer. Regular computer maintenance is important to keep your computer running well for as long as possible and utility software is a great asset to have for maintenance.

If the software doesnt run regular scans, its a good idea to run a scan at least once every week. If you run into any viruses or moderate to severe errors, its also a good idea to run the software directly afterward to resolve additional errors and clean up junk which may have been created during the error.


Image Credit: Grant Cochrane.

Available link for download




Read more »