Tutorial on Special Operators of C Language

Special Operators
Special Operators of C:
  1. Comma Operator
  2. Size of()
  3. Address Operator
  4. Dereferencing Operator
  5. Dot Operator
  6. Arrow Operator
Lets we have to Discuss Some Popular Special Operators of C:

=> Sizeof () Operator:
  • This Operator returns the size(i.e number of bytes) of operand.
  • It should be written in lowercase Letter.
  • The operand may be constant , a variable , or a data type.
  • It is used for dynamic memory allocation.
  • It is also used to determine the size of arrays and structures.
Syntax:

  sizeof (operand); 

Example:
x = sizeof (int);
y = sizeof (sum);

Program of Sizeof () Operator:
Statement: This Program illustrates the use of sizeof () Operator:
{
int a;
float b;
char ch = 'c' ;
a = 2;
b = 10.0;
printf(" Size of a = %d\n" , sizeof (a) );
printf(" Size of b = %f\n" , sizeof (b) );
printf(" Size of ch = %c\n" , sizeof (ch) );
Output:
Size of a = 2
Size of b = 4
Size of ch = 1

=> Shorthand Assignment Operators:
  • C provides a compact way of writing assignment Statements in an Expression.
  • This is basically associated with all arithmetic Operators and bitwise Operators.
Syntax:


  var | operator | = | exp |   

where
var => is a variable
operator => an airthmetic or bitwise operator
exp => is an Expression

NOTE:  
  • There is no space between the operator and the '=' sign in compact representation.
  • Shorthand Assignment operators are easier to read , write and understand.
Program of Shorthand Assignment Operators:
{
int a , b , c;
a = 3;
b = 4;
c = 1;

a += b;
b -= a;
c *= x;

printf("%d\n" , a);
printf("%d\n" , b);
printf("%d\n" , c);
Output:
 7
 -1
 5
                                                         
                                                                  That's All

0 Response to "Tutorial on Special Operators of C Language"

Post a Comment

Popular Posts

Label

1 Sidebar 2 Columns 3 Columns Footer 3rdball 4 Columns Footer Alex Alvaro Antsasia Arlinadesign Averie Barry BASIC CONCEPTS Basil Bayna Fast BeautyPress BeautyTemplates Beckel Best Best - Clean Beyonce Pro BioMag BlackMag Blanter Nova Blogger Card Bloggertheme9 Blogish Bpress Brakt C LANGUAGE C PROGRAMS C++ LANGUAGE C++ PROGRAMS Carella Cellar Charlotte Chooko Lite Clara Clean Combo One Cooperate Crusade Darry Dorman Dreamway Dunia Blanter eCars EduAcademy EducationPress Elise Elvan Eva Everyday FabNews Fashion Fashion Blogger Template Fashion Gossip FastCars Fedo FlashNews Fredy Portfolio Gaming Globus GoodTime Goomsite HTML LANGUAGE iGaming Indicate Innove Insomnia InspiredNews iSoft Jasmine Kalem Landscaping Lashira Lavelle Lily Fashion Limax Linea Lionex Luminescence Lite Lumix Luxury Magazine MagazinePro MAJOR DIFFERENCES MarketingBlog Martin MaxiMag Medica Mega Melissa Mercury MeshMag Minimag Minimalist MiniNews MovieKhor msdesignbd MusicLand Neko NetZine New Spread News16 Newsflash NewsForce NewsIdea Newspaper News NewsPro Nubie Fast Odd Themes Optima PaperMag PaperMag blog Parhlo Perfection Personal Personal Blog Photosout PixelZ Power Blog Premium Themes ProfileMag Purez Rano ReadNews Real estate Remito Grid Responsive Revo Robusta Rotario Saara SeoBoost Settle Shouters Simple Catch SimpleClean Sketchly SNews SolidMag Someo Sophie Sora Sora Bank Sora Home Sora News Responsive Sora One Sora Ribbon Spido Sticko Stucco Sure Mag Swift Tech Tech Pro Techia Techmax TechSpot TemplateClue Templateism Templatesilk Templatesyard Templatezy The Freelancer TheBlogger TheFocus Themeforest Themexpose TIPS AND TRICKS Topside TravelMag Trendy Trendy Travel Tumblr Under Construction Uong Jowo Veethemes Vertox VideoPlay Vigo Waverly way2themes WebBiz Wedding X-Mag Zealer ZetaMag