Pointers in C and C++

Posted by Tushar Bedekar
The correct understanding and use of pointers is crucial to successful C programming. There are several reasons for this: First, pointers provide the means by which functions can modify their calling arguments. Second, pointers support dynamic allocation. Third, pointers can improve the efficiency of certain routines. Finally, pointers provide support for dynamic data structures, such as binary trees and linked lists.
Pointers are one of the strongest but also one of the most dangerous features in C. For example, a pointer containing an invalid value can cause your program to crash. Perhaps worse, it is easy to use pointers incorrectly, causing bugs that are very difficult to find. Because of their importance and their potential for abuse, this chapter examines the subject of pointers in detail.

What Are Pointers?

A pointer is a variable that holds a memory address. This address is the location of another object (typically another variable) in memory. For example, if one variable contains the address of another variable, the first variable is said to point to the second. 


Pointer Variables

If a variable is going to be a pointer, it must be declared as such. A pointer declaration consists of a base type, an *, and the variable name. The general form for declaring a pointer variable is
type *name;
where type is the base type of the pointer and may be any valid type. The name of the pointer variable is specified by name.
The base type of the pointer defines the type of object to which the pointer will point. Technically, any type of pointer can point anywhere in memory. However, all pointer operations are done relative to the pointer's base type. For example, when you declare a pointer to be of type int *, the compiler assumes that any address that it holds points to an integer— whether it actually does or not. (That is, an int * pointer always ''thinks" that it points to an int object, no matter what that piece of memory actually contains.) Therefore, when you declare a pointer, you must make sure that its type is compatible with the type of object to which you want to point.

The Pointer Operators

There are two pointer operators: * and &. The & is a unary operator that returns the memory address of its operand. (Remember, a unary operator only requires one operand.) For example,
m = &count;
places into m the memory address of the variable count. This address is the computer's internal location of the variable. It has nothing to do with the value of count. You can think of & as returning "the address of." Therefore, the preceding assignment statement can be verbalized as "m receives the address of count."
Image result for pointer in cTo understand the above assignment better, assume that the variable count uses memory location 2000 to store its value. Also assume that count has a value of 100. Then, after the preceding assignment, m will have the value 2000.
The second pointer operator, *, is the complement of &. It is a unary operator that returns the value located at the address that follows. For example, if m contains the memory address of the variable count,
q = *m;
places the value of count into q. Thus, q will have the value 100 because 100 is stored at location 2000, which is the memory address that was stored in m. You can think of * as "at address." In this case, the preceding statement can be verbalized as "q receives the value at address m."

note:-These are the basic things that we have discussed today for more articles on pointer stay connected with us.

For any kind of doubts feel free to ask on contact us
     
Read More

How to get best Android phone for today: 5 models

Posted by Tushar Bedekar
These days everyone seems to want the latest smart phone to come out, but who can blame them when you look at how rapidly these devices are improving. Technology truly has ramped up the speed at which we consume new products, although that simply means that consumers have more access to better quality materials. Although Apple continues to dominate the smart phone market, there is no question that Android is highly popular and a good percentage of the population would not even consider purchasing a new phone. If you want to get your hands on the latest Android phone's, a good place to start is by doing some research on the internet and checking out the various models that they currently have available. 
Although you might want to go into the store to make your actual purchase, more and more people are preferring to pick up their new smart phones over the internet. This is due in large part to the fact that you can generally get much better deals over the internet, because the online retailers have to compete with all sorts of sites, where as if you were to walk into a store, they do not have much competition. For this reason alone, you should see if you can find a better price online, although it is a good idea to head to the stores to actually get the phones you are looking at in your hand, so you get a feel of whether you like them or not. However, if you are a die hard Android fan, this may not pertain to you, as you likely are going to purchase their products anyway. 
If you are looking into getting a brand new Android phone, you may want to consider some of these models. The Samsung Galaxy Note 5 has gotten great reviews online and is far superior than the previous models that Samsung has put out in the past, which were lacking in a great deal of areas. They Galaxy Note 5 features a top of the line display screen, which has gotten the phone a lot of attention. The overall features in the phone, in regards to multitasking, taking pictures and videos, and maintaining a long battery life, are drastically better than previous Samsung models. 
The LG G4 is one of the highest rated Androids on the market right now and they have been called a great all around smart phone. The display screen is crisp and the camera takes high quality shots consistently and there is no question that the software is drastically improving as well. Samsung has another great Android model out, which is the Galaxy S6. This phone has had some reviews that are calling it hands down the best phone on the market, including the iPhone, which got a ton of people's attention. There is no doubt that this is a high quality phone worth considering and at about three hundred dollars less than the Galaxy Note 5, it may be an overall better purchase.
If you are looking for a bit of a cheaper phone that still has a ton of the same capabilities and looks great, you might want to check out the Moto X. Although this phone is less popular and has gotten lower reviews, the camera is of the utmost quality, the software on the phone is great and it holds a long battery life. The Sony Xperia Z5 Premium is another great phone that will also likely get you a lot of looks. This is due to the fact that they sell a bright gold smart phone, which looks amazing and is on par function wise as the top Androids on the market.

About Author: This article was written by Andy G, a tech geek and Linux guru from Austria. At the present moment he maintains firmware 

and driver download website called http://www.helpjet.net/
Read More

How A Software Actually Works On A Hardware

Posted by Tushar Bedekar
Hi,Today We are going to discuss a new topic which may be very old but important one, also a big question in front of  us.

What is a Program me?

As we all know that a program me is a group of instruction which is needed to be executed by the machine like a computer to perform a certain task.but the biggest question is that how these group instruction are executed on the hardware to perform a assigned task.Basically these instructions which are being executed are itself a group of micro instruction an microcode.which are executed on any machine to execute a one particular instruction. now,

what is programming?

 Actually the programming is nothing but Def:- provide (a computer or other machine) with coded instructions for the automatic performance of a task.But This definition does not gives the full idea about what actually the programming is? and also it does not gives the idea about how the software runs on the hardware.   

As we all have listened about PLA`s(programmable array logic), PAL`s (programmable logical array) and also about FPLA (field programmable logical array).Basically these are the logical devices consisting of arrays of AND & OR gates and also other different supporting devices.These devices may be Hardwired or may be re-programmable.

How To program me these devices?  

Basically devices consist of programmable AND & OR gates.That these arrays consist of fussing and re fussing technology.These fuses may be burned and or lay intact as per the requirement.This fussing can be done generally by supplying a sufficient amount of current through the fuse. 


Types of fuses:- 

  • Metallic Fuses.
  • Diode/Transistors fuses
  • Silicon Fuses.Etc
So by fussing the different fuses the programming can be done.


Publisher's Last Words:

  • If you Find this article incomplete please help us to improve it.I am greatly honored if helps us. contact us
  • If you want to post your article on http://www.allaboutcomputing.net you can contact us at link:- contact us. For more about Computer programming and computer technology or web designing stay connected with http://www.allaboutcomputing.net .
  • I hope you have got answers of some Questions by this small post and I know you have lot of questions, So please feel free to ask in comment section or you can mail me my    e mail id is : tushar.bedekar11@gmail.com 



 


Read More

What is BootStrap

Posted by Tushar Bedekar

Definition - What does Bootstrap mean?

A bootstrap is the process of starting up a computer. It also refers to the program that initializes the operating system (OS) during start-up.

The term bootstrap or bootstrapping originated in the early 1950s. It referred to a bootstrap load button that was used to initiate a hardwired bootstrap program, or smaller program that executed a larger program such as the OS. The term was said to be derived from the expression “pulling yourself up by your own bootstraps;” starting small and loading programs one at a time while each program is “laced” or connected to the next program to be executed in sequence.
OR
Bootstrap is the process of loading a set of instructions when a computer is first turned on or booted. During the start-up process, diagnostic tests are performed, such as the power-on self-test (POST), that set or check configurations for devices and implement routine testing for the connection of peripherals, hardware and external memory devices. The boot loader or bootstrap program is then loaded to initialize the OS.

Typical programs that load the OS are:

  • GNU grand unified boot loader (GRUB): A multiple boot specification that allows the user to choose one of several OSs

  • NT loader (NTLDR): A bootloader for Microsoft’s Windows NT OS that usually runs from the hard drive

  • Linux loader (LILO): A bootloader for Linux that generally runs
    from a hard drive or floppy disc

  • Network interface controller (NIC): Uses a boot loader that supports booting from a network interface such as Ether boot or pre-boot execution environment (PXE)
Prior to bootstrap a computer is said to start with a blank main memory and an intact magnetic core memory or kernel. The bootstrap allows the sequence of programs to load in order to initiate the OS. The OS is the main program that manages all programs that run on a computer and performs tasks such as controlling peripheral devices like a disc drive, managing directories and files, transmitting output signals to a monitor and identifying input signals from a keyboard. 

Bootstrap can also refer to as preparing early programming environments incrementally to create more complex and user-friendly programming environments. For example, at one time the programming environment might have consisted of an assembler program and a simple text editor. Over time, gradual improvements have led to today's sophisticated object-oriented programming languages and graphical integrated development environments (IDEs).

Read More

What is the Diffeence Between Execution & Processing

Posted by Tushar Bedekar

What is Processing:-

In computing, a process is an instance of a computer program that is being executed. It contains the program code and its current activity. Depending on the operating system (OS), a process may be made up of multiple threads of execution that execute instructions concurrently
A computer program is a passive collection of instructions; a process is the actual execution of those instructions. Several processes may be associated with the same program; for example, opening up several instances of the same program often means more than one process is being executed.
Multitasking is a method to allow multiple processes to share processors (CPUs) and other system resources. Each CPU executes a single task at a time. However, multitasking allows each processor to switch between tasks that are being executed without having to wait for each task to finish. Depending on the operating system implementation, switches could be performed when tasks perform input/output operations, when a task indicates that it can be switched, or on hardware interrupts.
A common form of multitasking is time-sharing. Time-sharing is a method to allow fast response for interactive user applications. In time-sharing systems, context switches are performed rapidly. This makes it seem like multiple processes are being executed simultaneously on the same processor. The execution of multiple processes seemingly simultaneously is called concurrency.
For security and reliability reasons most modern operating systems prevent direct communication between independent processes, providing strictly mediated and controlled inter-process communication functionality.

What is Execution:- 

The dictionary meaning of the execution is carrying out of a plan, order, or course of action 
or in other words it is an act of doing or performing something.

Examples:-




  1. He is in prison awaiting execution.
  2. The quarterback's execution of the play was perfect.
  3. skillful execution of the dance steps
  4. Execution of sequential instruction of the program me.  

Sources:-

Wikipedia

Read More

What is Bandwidth ?

Posted by Tushar Bedekar
This is most confusing topic for most of the electronics engineers today.But it is a most important topic because it is one basic topic for the communication engineering.so i find this topic to write first while writing my first topic on electronics engineering.


Introduction:-

According to me following are the different definition of the bandwidth:-

  •  The range of the frequencies that can be passed without any attenuation through any communication devices.
  • The portion of electromagnetic spectrum that is being occupied by the signal.
  • Signal is a physical quantity which consist of some information and which is the function of one or more independent variables.
  • Bandwidth as Difference between upper and lower limit of the signal.
  • let F1=50 Hz  & F2=80 Hz Band width =30 Hz (F2-F1)
But as per the above definition`s about the bandwidth it does not give that much of information that we require to understand the topic in detail.

More Info:-

  • The Internet consists of tens of millions of computers throughout the world, all connected by cables. Your ISP (Internet Service Provider) is a company that has a very high-speed (and very expensive) connection to the Internet. Your ISP makes its money by renting little "chunks" of that high-speed connection to consumers who don't want to spend thousands of dollars each month for an Internet connection.
    If you've ever wondered why it takes so long to download certain Web pages or other files to your computer, it's all determined by the bandwidth of the connection between your computer and your Internet Service Provider. Which is to say, it all hinges on that wire connecting your computer to your modem to your ISP. That connection is often referred to as the last mile, as illustrated in Figure 1.
    When you open a Web page or download a file, it travels very quickly from wherever it happens to be on the planet Earth to your ISP. It then travels from the ISP's computers to your computer. The actual speed at which information moves through a wire is always the same, no matter what your bandwidth might be. That is, electrons run through the wires at close to the speed of light, about  670,000,000 MPH (six hundred and seventy million miles per hour). At that speed, you could circle the globe 7 times a second, or 420 times a minute. So why does it take so long for every Web page you visit to appear on your screen? That's where bandwidth comes in.
    Bandwidth is easy to understand if we use an analogy from everyday life. Imagine that instead of trying to get a Web page or file from your ISP through wires, you're trying to drain a swimming pool. The water in the pool is the Web page or file. If you stick a skinny hose to drain the water from the pool, as in Figure 2, it will take quite a while to drain all the water.
    Figure 1
    Now let's say that instead of sticking a skinny pipe onto the pool we put on a big fat pipe, as in Figure 3. I don’t think it takes a physics major to realize that it’s going to take less time to drain the pool in Figure 3 than it is to drain the pool in Figure 2.

    Figure 2
    We can say that the fat drain pipe in Figure 3 is "wider" than the pipe in Figure 2. Or, we could take it another step and say that the fat pipe in Figure 3 has more bandwidth than the skinny pipe. And ultimately, that's what bandwidth is all about. How much stuff can pass through the pipe (or wire) at a time.
    Dial-up Internet accounts, which use a standard telephone line to connect to an ISP, have a very narrow bandwidth (about 50 Kbps or 50,000 bits per second). Thus, things are slow in the sense that it takes a long time to download things.
    broadband Internet account can move data at anywhere from 128 Kbps to 2,000 Kbps or more. That's like the fat drain pipe. It takes a lot less time to get a Web page or file from your ISP's computer to your computer using the broadband account than it does the dial-up account.
    So the whole bandwidth thing (like many things "computerish") boils down to a time vs. money decision. You can either spend the extra amount per month for a faster connection, and spend less time waiting for things to download. Or, you spend less money on a dial-up account, but spend more time waiting for things to appear on your screen.
  • Also Refer:-




Read More
back to top