• Call Us: +91 9437911966
  • Email Us: info@studentstutorial.com
  • Home
  • C Examples
  • Server Side
    • PHP
    • Java
    • CodeIgniter
    • Laravel
    • JSP
    • JDBC
  • Frontend
    • HTML
    • CSS
    • Javascript
    • jQuery
    • AJAX
    • FPDF
    • TCPDF
  • APP & DB
    • Android
    • Cordova
    • SQL
    • Oracle
  • Project
C Tutorial C Introduction C Characteristic C Comments C Operator C Assign Operator C Arithmetic Oper.. C Logical Operator C Modulus Operator C Variable C Initialise Variable C Print F C Translators C Programming C Control Flow C If Else Statement C Nested If Else C Loops C While Loops C For Loops C Do While C Nested Loops

Syntax to Initialise a Variable in C

  • Students Tutorial
  • 08 jun 2020
   

Data Type variable = Value;

Int a;       Error 
Int a;
Int a b c;    Error
Int a, b, c;
Int a b c, d;
Int if;  Error
Int If; yes valid because C case sensitive and all keywords in same case.
Int – if; yes valid 
Int 1, 2, 3;    Error Constant does not allowed
Int ─1, ─2,─3;  valid
Int 1a, 1b, 1c;    Error
Int a1, b1, c1;   Yes
Int total –sal ;    Error
Int total-sal;   yes
Int print F; valid

All keywords are reserved words but all reserved words are not keywords.
Because-

Like print f is keyword not defined in java, c#, etc.

As per the variable declarations for naming conversion we required to follow 2 rules-

1-Camel Notation

According to this notation first characters of every word should be required in upper case & every subsequent word also is required to follow the same condition.
E.g. Int Total salary;

2-Hungarian Notation

Acc. to this notation every variable should require a prefix which indicates what type of data type is the variable.

The basic difference b/w declaration and initialization of a variable is in declaration of the variable after creating the memory. It stores garbage value until we are assigning the data. In initialization of the variable after creating the m/m by default it stores what value is assigned.

Student Tutorial is a online tutorial for web design and development. Here you can find easy example and explanation for each tutorial.
Copyright © 2016-2025 Student Tutorial

Server Side

  • PHP
  • Java
  • CodeIgniter
  • Laravel
  • JSP
  • JDBC

Frontend

  • HTML
  • CSS
  • Javascript
  • jQuery
  • AJAX
  • FPDF

App & Database

  • Android
  • Cordova
  • SQL
  • Oracle