C Programming Data Type

Posted by Tushar Bedekar
In C, variable(data) should be declared before it can be used in program. Data types are the keywords, which are used for assigning a type to a variable.In other words we can define the data type as a keyword which specifies the type of the data to be processed during the execution of the program me. 

Data types determine the following:

• Range of the data
• Type of the data stored
• Number of bytes it occupies in memory





C supports following data types:

• int – occupies 2 (16-bit compiler) or 4 bytes (32-bit compiler) of memory
• float – occupies 4 byes of memory
• double – occupies 8 bytes of memory
• char – occupies 1 byte of memory

Integer Data Type:-

int is used to define integer numbers. It occupies 2 bytes of memory (16-bit compiler).Keyword int is used for declaring the variable with integer type. For example:
The size of int is either 2 bytes(In older PC's) or 4 bytes. If you consider an integer having size of 4 byte( equal to 32 bits), it can take 232 distinct states as: -231,-231+1, ...,-2, -1, 0, 1, 2, ..., 231-2, 231-1
Similarly, int of 2 bytes, it can take 216 distinct states from -215 to 215-1. If you try to store larger number than 231-1, i.e,+2147483647 and smaller number than -231, i.e, -2147483648,  program will not run correctly.

Float Data Type:-

float is used to define floating type numbers. It occupies 4 bytes of memory
(16-bit compiler).Variables of floating types can hold real values(numbers) such as: 2.34, -9.382 etc. Keywords either float or double is used for declaring floating type variable. For example:

Double Data Type:-

double is used to store big floating point numbers. It reserves 8 bytes of memory (16-bit compiler)

Difference between float and double:-

Generally the size of float(Single precision float data type) is 4 bytes and that of double(Double precision float data type) is 8 bytes. Floating point variables has a precision of 6 digits whereas the the precision of double is 14 digits.
Note: Precision describes the number of significant decimal places that a floating values carries.

Char Data Type:-

char is used to store characters. It occupies 1 byte of memory (16-bit compiler).The size of char is 1 byte. The character data type consists of ASCII characters. Each character is given a specific value. For example:

Summary:

Following table is applicable for 16-bit compiler.

Read More

Asus Zenfone 5-Five Fearures You Need To Know

Posted by Tushar Bedekar
The Taiwan based company; Asus that is rapidly expanding and spreading its wings all over the globe have launched a new series of budget friendly smartphones called the Zenfone. The Zenfone series has three models, Zenfone 4, Zenfone 5 and Zenfone 6 which were revealed at CES this year. The company has managed to create a lot of buzz in the Indian market and has raised many eyebrows because of its affordable price.  
This article reviews the second model in the series, Zenfone 5. This Smartphone has certainly got enough attention mainly because of its ergonomic design. It has basic looks yet it gives a high-end feel. The phone very comfortably sits in the hand, which is why it becomes easier to handle the phone. It has three navigation buttons namely Back, Home and recent. The five features which make this phone worth giving a shot are-

Mesmerizing Display:-

The Smartphone boasts of a 5-inch IPS HD display with great viewing angles. The screen has a pixel density of 294 ppi which delivers crisp and sharp pictures and the colors look original and vibrant. One drawback about the display is that the screen is very reflective and the contents appear to fade a little in the sunlight. This problem can be solved by increasing the brightness. It has a corning Gorilla Glass 3 for the protection of the screen. The phone comes with a glove mode, which allows users to work on the phone even with gloves on, truly a great feature.

Excellent Hardware Configuration:-

The Smartphone clutches a RAM of 2GB with a 1.6 GHz dual-core Intel Atom Z2560 processor. This means all your apps and heavy graphic games will run very smoothly without any lag. Coming with a mammoth 64 GB of expandable memory, the Zenfone comprises of a handsome 8 GB or 16 GB internal memory. The device is a dual SIM (both micro SIM) with a battery of 2,110 mAh.

Appreciable Camera Quality:-

The Zenfone 5 sports an 8 megapixel rear camera with an LED flash and f/2.0 aperture lens. A 2 megapixel front camera is also present for video calling and selfie moments. The phone has few inbuilt camera apps that offer 18 different modes. The most notable camera tool is Time Rewind which saves upto 31 images beginning 2 seconds before the shutter button is pressed. The pictures clicked by the phone are decent in low light and give much more detail in a well lit environment.

Latest Android OS:-

Asus’s Zenfone works on android 4.3 Jelly Bean with company’s ZenUI skin on top. Asus has announced that the latest version of Android 4.4 Kitkat will be available very soon. The ZenUI gives you the option to customize the elements on screen like the transparency level and theme color. Google chrome is offered additionally with the default browser of the phone.

Affordable Price Tag:-

The Asus Zenfone 5 can be taken into consideration for people who want a big screen at a low price tag. Priced at 9,999/-, this smartphone is one of the best budget Smartphone in the 10K segment in India.

Author Bio:

The article has been written by Kundan Srivastava, who is passionate about technology. He's working at 91mobiles.com and writes about the latest in the tech domain, right from devices to innovations. He recommended Asus Zenfone 5 as one of the best budget Smartphone.


Publisher's Last Words:

This is guest post by Kundan Srivastava, Thanks to Kundan Srivastava for this awesome and useful information.if you want to post your article on http://www.allaboutcomputing.net you can contact me. For more about Computer programming and for many more about Computer 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

Literals in C Programming

Posted by Tushar Bedekar
The term literal constant or literal refers to a value that occurs in a program and cannot be changed. The C language uses the term constant in place of the noun literal. The adjective literal adds to the concept of a constant the notion that we can speak of it only in terms of its value. A literal constant is nonaddressable, which means that its value is stored somewhere in memory, but we have no means of accessing that address.

Every literal has a value and a data type. The value of any literal does not change while the program runs and must be in the range of representable values for its type. The following are the available types of literals:


Types:-


  • Boolean
  • Integer
  • Character
  • Floating-point
  • String
  • C Compound literal
  • Vector literal
According to Wikipedia  a literal is a notation for representing a fixed value in source code. Almost all programming languages have notations for atomic values such as integers,floating-point numbers, and strings, and usually for booleans and characters; some also have notations for elements of enumerated types and compound values such as arrays,records, and objects. An anonymous function is a literal for the function type.

In contrast to literals, variables or constants are symbols that can take on one of a class of fixed values, the constant being constrained not to change. Literals are often used to initialize variables, for example, in the following, 1 is an integer literal and the three letter string in "cat" is a string literal:
Read More

How to open webpage in chrome browser offline

Posted by Tushar Bedekar

Many Times in the absence of the internet connectivity we are require to access the certain webpages that we have previously accessed when we have internet connectivity.For example during connectivity we a have opened Facebook,Gmail and Wikipedia etc. similarly when we are suppose to be inside the airplane there is no connectivity due to which we can`t access internet and In such situations if we open our chrome history an click on the previously sites than we see a page showing a dynasore saying that your computer is not connected to internet.


At the same time there is also no setting in the chrome browser by using which you are able to use chrome in the offline mode so by using the trick Given below you can use your browser in the offline mode.


Offline reading in chrome(Trick):-

  • first of all open chrome browser.
  • In the address bar write chrome://flags/#enable-offline-mode
  • then press enter.
  • now you will see an auto reload option in the window open in your browser.
  • which is set in the default mode.
  • revert that option to enable mode.
  • then restart your chrome browser.
Then after restarting your chrome browser move to history by pressing ctrl+H 
select the site that you want to see offline and enjoy.







Warning 

  • We are not responsible for any damages that may happened by using this Techniques. 
  • Use this guide at your own risk. We shall not have any liability or responsibility for whatever happens to you and your device by using the instructions in this guide.
  • The instructions provided in this tutorial for educational purpose only. There is no guarantee that these steps will work for your device.
  •  Applying this guide to any other device or any other model may produce many problems.
  • Read and Understand the whole tutorial first, before going to perform the steps.
  • At the same time this content is not to harm any one but it is only for educational purpose.
Read More

Constants, Variables and Keywords in C

Posted by Tushar Bedekar

Constants:-

A constant is an entity whose value does not change throughout the program execution.

There are rules to be followed in order to create a constant. Let us discuss the rules to create constants.







Rules for constructing Integer constant

1) An integer constant must have at least one digit.
2) It must not have a decimal point.
3) It can either be positive or negative.
4) No commas or blanks are allowed within an integer constant.

5) If no sign precedes an integer constant, it is assumed to be positive.
6) The allowable range for integer constants is -32768 to 32767


 Actually, the range of the integer constant depends on the compiler. The above mentioned range is for 16-bit compiler. However, for a 32-bit compiler the range would be even greater.

The integer constants
• Whole Numbers
• E.g. 50, 45, -35, -26
• Computer allocates only 2 bytes in memory.
• 16th bit is sign bit. (if 0 then positive value, if 1 then negative value)

Decimal Integer constant:
• 0 to 9
• E.g.: 49, 58, -62 … (40000 cannot come because it is > 32767)

Octal Integer constant:
• 0 to 7
• Add “0” before the value.
• E.g.: 045, 056, 067

Hexadecimal Integer constant:
• 0 to 9 and A to F
• Add 0x before the value
• E.g.: 0×42, 0×56, 0×67


Rules for constructing Real constants


Rules for constructing Real constants (Fractional Form)
1) A real constant must have at least one digit
2) It must have a decimal point
3) It could be either positive or negative
4) If no sign precedes an integer constant, it is assumed to be positive.
5) No commas or blanks are allowed within a real constant.

E.g.: +867.9, -26.9876, 654.0


Rules for constructing Real constants (Exponential Form)

1) The mantissa part and the exponential part should be separated by the letter ‘e’
2) The mantissa may have a positive or negative sign(default sign is positive)
3) The exponent must have at least one digit
4) The exponent must be a positive or negative integer(default sign is positive)
5) The range of real constants in exponential form is -3.4e38 and +3.4e38

E.g.: +3.2e-4, 4.1e8, -0.2e+4, -3.2e-4


Rules for constructing Character constant

1) A character constant is an alphabet, a single digit or a single special symbol enclosed within inverted commas. Both the inverted commas should point to the left. For example, ’S’ is a valid character constant whereas ‘S’ is not.
2) The maximum length of a character constant can be 1 character. Allots 1 byte of memory


Variable:-

A variable is an entity whose value keeps on changing throughout the program execution. However, it’s not a rule that the value of the variable will change. A variable value might remain same throughout the program execution. However the main difference between variable and constant is that we can’t change the value of constant in between the program, but we can change the value of the variable during program execution.


Rules for constructing variable names

A Variable name consists of any combination of alphabets, digits and underscores. Some compiler allows variable names whole length could be up to 247 characters. Still it would be safer to stick to the rule of 31 characters. Please avoid creating long variable name as it adds to your typing effort
The first character of the variable name must either be alphabet or underscore. It should not start with the digit
No commas and blanks are allowed in the variable name
No special symbols other than underscore are allowed in the variable name
We need to declare the type of the variable name before making use of that name in the program. Type declaration can be done as follows:

To declare a variable as integer, follow the below syntax:


int variable_name;
Here int is the type of the variable named variable_name. ‘int’ denotes integer type.

Following are the examples of type declaration statements:




E.g.:

int p, n;
float r;

keyword:-

Keywords are the words whose meaning has already been explained to the C compiler. The keyword cannot be used as the variable name. If we try to do so we are trying to assign new meaning to the keyword. The keywords are also known as ‘Reserved words’.

E.g.: for, if, static, while, do, break etc.

Let us take an example:-
We define a variable named x in a program. Let us say x=9.
After some time during execution we change the value of x to 10. Now, x=10.
Here value of x is getting changed. But the value of 9 and 10 will never change. Hence, x is called a variable and 9 is called a constant.

Read More

What really happens when you navigate to a URL

Posted by Tushar Bedekar 3 Comments

1. You enter a URL into the browser 




 2. The browser looks up the IP address for the domain name 


Now the question comes in your mind What is DNS??????????
Answer is->Full Form of DNS is Domain Name System.The DNS translates Internet domain and host names to IP addresses. DNS automatically converts the names we type in our Web browser address bar to the IP addresses of Web servers hosting those sites.

The DNS lookup proceeds as follows:
  • Browser cache – The browser caches DNS records for some time. Interestingly, the OS does not tell the browser the time-to-live for each DNS record, and so the browser caches them for a fixed duration (varies between browsers, 2 – 30 minutes).
  • OS cache – If the browser cache does not contain the desired record, the browser makes a system call (gethostbyname in Windows). The OS has its own cache.
  • Router cache – The request continues on to your router, which typically has its own DNS cache.
  • ISP DNS cache – The next place checked is the cache ISP’s DNS server. With a cache, naturally.
  • Recursive search – Your ISP’s DNS server begins a recursive search, from the root nameserver, through the .com top-level nameserver, to Facebook’s nameserver. Normally, the DNS server will have names of the .com nameservers in cache, and so a hit to the root nameserver will not be necessary.

3. The browser sends a HTTP request to the web server



You can be pretty sure that Facebook’s homepage will not be served from the browser cache because dynamic pages expire either very quickly or immediately (expiry date set to past). So, the browser will send this request to the Facebook server: GET http://facebook.com/ HTTP/1.1 Accept: application/x-ms-application, image/jpeg, application/xaml+xml, [...] User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; [...] Accept-Encoding: gzip, deflate Connection: Keep-Alive Host: facebook.com Cookie: datr=1265876274-[...]; locale=en_US; lsd=WW[...]; c_user=2101[...] The GET request names the URL to fetch: “http://facebook.com/”. The browser identifies itself (User-Agentheader), and states what types of responses it will accept (Accept and Accept-Encoding headers). TheConnection header asks the server to keep the TCP connection open for further requests. The request also contains the cookies that the browser has for this domain. And so the cookies store the name of the logged-in user, a secret number that was assigned to the user by the server, some of user’s settings, etc. The cookies will be stored in a text file on the client, and sent to the server with every request.

 4. The facebook server responds with a permanent redirect 



This is the response that the Facebook server sent back to the browser request: imageHTTP/1.1 301 Moved Permanently Cache-Control: private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Expires: Sat, 01 Jan 2000 00:00:00 GMT Location: http://www.facebook.com/ P3P: CP="DSP LAW" Pragma: no-cache Set-Cookie: made_write_conn=deleted; expires=Thu, 12-Feb-2009 05:09:50 GMT; path=/; domain=.facebook.com; httponly Content-Type: text/html; charset=utf-8 X-Cnection: close Date: Fri, 12 Feb 2010 05:09:51 GMT Content-Length: 0 The server responded with a 301 Moved Permanently response to tell the browser to go to “http://www.facebook.com/” instead of “http://facebook.com/”. 

 5. The browser follows the redirect 


The browser now knows that “http://www.facebook.com/” is the correct URL to go to, and so it sends out another GET request: GET http://www.facebook.com/ HTTP/1.1 Accept: application/x-ms-application, image/jpeg, application/xaml+xml, [...] Accept-Language: en-US User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; [...] Accept-Encoding: gzip, deflate Connection: Keep-Alive Cookie: lsd=XW[...]; c_user=21[...]; x-referer=[...] Host: www.facebook.com The meaning of the headers is the same as for the first request.


 6. The server ‘handles’ the request 


 The server will receive the GET request, process it, and send back a response. imageThis may seem like a straightforward task, but in fact there is a lot of interesting stuff that happens here – even on a simple site like my blog, let alone on a massively scalable site like facebook. Web server softwareThe web server software (e.g., IIS or Apache) receives the HTTP request and decides which request handler should be executed to handle this request. A request handler is a program (in ASP.NET, PHP, Ruby, …) that reads the request and generates the HTML for the response. Request handlerThe request handler reads the request, its parameters, and cookies. It will read and possibly update some data stored on the server. Then, the request handler will generate a HTML response. 

 7. The server sends back a HTML response 


 Here is the response that the server generated and sent back: HTTP/1.1 200 OK Cache-Control: private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Expires: Sat, 01 Jan 2000 00:00:00 GMT P3P: CP="DSP LAW" Pragma: no-cache Content-Encoding: gzip Content-Type: text/html; charset=utf-8 X-Cnection: close Transfer-Encoding: chunked Date: Fri, 12 Feb 2010 09:05:55 GMT The entire response is 36 kB, the bulk of them in the byte blob at the end that I trimmed. The Content-Encoding header tells the browser that the response body is compressed using the gzip algorithm. After decompressing the blob, you’ll see the HTML you’d expect: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" id="facebook" class=" no_js"> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-language" content="en" /> ... In addition to compression, headers specify whether and how to cache the page, any cookies to set (none in this response), privacy information, etc. 

 8. The browser begins rendering the HTML 


 Even before the browser has received the entire HTML document, it begins rendering the website: 

 9. The browser sends requests for objects embedded in HTML 



 As the browser renders the HTML, it will notice tags that require fetching of other URLs. The browser will send a GET request to retrieve each of these files. Here are a few URLs that my visit to facebook.com retrieved: Imageshttp://static.ak.fbcdn.net/rsrc.php/z12E0/hash/8q2anwu7.gif http://static.ak.fbcdn.net/rsrc.php/zBS5C/hash/7hwy7at6.gif … CSS style sheetshttp://static.ak.fbcdn.net/rsrc.php/z448Z/hash/2plh8s4n.css http://static.ak.fbcdn.net/rsrc.php/zANE1/hash/cvtutcee.css … JavaScript files http://static.ak.fbcdn.net/rsrc.php/zEMOA/hash/c8yzb6ub.js http://static.ak.fbcdn.net/rsrc.php/z6R9L/hash/cq2lgbs8.js 

 10. The browser sends further asynchronous (AJAX) requests 


 In the spirit of Web 2.0, the client continues to communicate with the server even after the page is rendered. For example, Facebook chat will continue to update the list of your logged in friends as they come and go. To update the list of your logged-in friends, the JavaScript executing in your browser has to send an asynchronous request to the server. The asynchronous request is a programmatically constructed GET or POST request that goes to a special URL. In the Facebook example, the client sends a POST request to http://www.facebook.com/ajax/chat/buddy_list.php to fetch the list of your friends who are online. This pattern is sometimes referred to as “AJAX”, which stands for “Asynchronous JavaScript And XML”, even though there is no particular reason why the server has to format the response as XML. For example, Facebook returns snippets of JavaScript code in response to asynchronous requests. 
Read More
back to top