C Variables and Types of Variables in C

C variable is a data name that may be used to store a data value. The value of the C variable may get change in the program and it can be reused many times.
syntax to declare a variable:
type variable name = value;

Example of C variables:

int i = 1, j = 2;               // Declaration and initializing i and j.
float f = 10.53;              //Declaration and initializing f.

Rules for defining variables:

  • C variable can have alphabets, digits, and underscore and must begin with a letter.
  • C variable name can start with the alphabet, and underscore only can have both upper and lower case letters. It can't start with a digit.
  • No whitespace is allowed within the variable name.
  • C variable name must not be any reserved word (or) keyword, e.g. int, float, char, etc.

Types of Variables in C: The types of variables in c are shown below:
  • The local variable.
  • Global variable.
  • The static variable.
  • Automatic variable.
  • External variable.

Local Variable: A variable that is declared inside the function or block is called a local variable. The local variable must be declared at the start of the block. And local variable must have to initialize before it is used.

Example of C Local variable:

void functionA()
int i=10; // "i" is the local variable.
Global Variable: Any variable that is declared outside the function or block is called a global variable. A global variable must be declared at the start of the function (or) block and it is available to all the functions. Any function can change the value of the global variable.

Example of C Global variable:

int i = 20;    // Here "i" is the global variable  
void function1()
 int j =10;    //Here "j" is the local variable  

Static variable: The static variable has a property of preserving their value even after they are out of their scope. Hence, static variables preserve their previous value in their previous scope and are not initialized again in the new scope.
static datatype varname = varvalue; 

Automatic variable: The variables which are declared inside a block are known as automatic these variables allocate memory automatically upon entry to that block and free the occupied memory upon exit from that block. These variables have local scope to that block only which means these can be accessed in which variable declared. Keyword 'auto' may be used to declare an automatic variable but we can declare these variables without using 'auto' keywords.
 Example: Below Both x, y are automatic variables
  int main()
    auto int x;
    int y;
    return 0;
External variables: External variables are also known as global variables. These variables are defined outside the function. These variables are available globally throughout the function execution. The value of global variables can be modified by the functions. “extern” keyword is used to declare and define the external variables. About the declaration shown below:
  • Declaration of a variable or function simply declares that the variable or function exists somewhere in the program, but the memory is not allocated for them. The declaration of a variable or function serves an important role–it tells the program what its type is going to be. In the case of function declarations, it also tells the program the arguments, their data types, the order of those arguments, and the return type of the function. So that’s all about the declaration.
  • Coming to the definition, when we define a variable or function, in addition to everything that a declaration does, it also allocates memory for that variable or function. Therefore, we can think of definition as a superset of the declaration (or declaration as a subset of definition).
#include <stdio.h>
extern int i = 24;
int j = 8;
int main() {
   auto int a = 32;
   extern int j;
   printf("The value of auto variable : %d\n", a);
   printf("The value of extern variables i and j : %d,%d\n",i,j);
   x = 15;
   printf("The value of modified extern variable i : %d\n",i);
   return 0;

SEO and Important of SEO

What is SEO?

SEO stands for Search Engine Optimization. It is the process of getting traffic from the free, organic, editorial, or natural search results on the search engines. And SEO is the process of improving the structure, content, and organization of your site to the Search engines can index them correctly. SEO may target different kinds of search, including image search, local search, video search, and news search engines.
what is seo

Important points to Note:

  • You ought to be mindful so as to remember the accompanying focuses so as to guarantee your image is all around situated on web indexes.
  • Web crawlers need to carry out their responsibilities as most ideal as by alluding clients to sites and substance that is generally important to what the client is searching for. This is dictated by the website content, how quick your webpage loads, how regularly your website is connected to from other dependable online assets, and client experience, including structure, route and skip rate. 
  • The things that the web crawlers don't need are: watchword stuffing, purchasing connections, and poor client experience (such a large number of promotions and high skip rates). 
  • Area naming is critical to your general marking. As a best practice, use sub-registry root areas (example.com/occasions) versus sub-spaces (events.example.com). Other accepted procedures with area names are to utilize steady spaces and watchwords in the URL. 
  • Upgrade for various kinds of results. Notwithstanding improving for work area experience, center around portable and tablet enhancement alongside other media. 
  • Content on the site ought to have title labels and meta depictions. Despite the fact that meta labels aren't as significant as they used to be previously; in the event that you do utilize them, guarantee they are organized effectively.
Also See: Java strings interview questions Java collections interview questions Java exception handling interview questions Java multithreading interview questions Java io streams interview questions Core Java interview questions Java constructor interview questions USPS Tracking USPS Hold Mail   Liteblue Liteblue login Earthlink Webmail  RCN Webmail BU Webmail Towson University Webmail Gmail login Shaw Webmail Cox Email GoDaddy Webmail Walmart Credit Card Login TCS Webmail bookzz liteblue usps gov human resources Hotmail login WalmartOne Login upsers outlook webmail Factorial program in Java constructor in java switch case in java java data types java if else Gmail sign in Gmail Gmail sign up AOL Mail login PSU Webmail Juno Webmail Rackspace Webmail Webmail DQFanSurvey Tellpopeyes survey Kroger feedback Disney hub tiktok login Netflix login


Our Services

Search This Blog

  • ()
Powered by Blogger.

C Variables and Types of Variables in C

C variable is a data name that may be used to store a data value. The value of the C variable may get change in the program and it can be r...