C Language | Comments , Format Specifier & Escape Sequence in C

What is Comments in C in Hindi ?


किसी भी प्रोग्रामिंग लैंग्वेज में Comments का उपयोग प्रत्येक लाइन मे लिखे code के बारे मे information provide करने के लिए की जाती है। code के दस्तावेजीकरण ( documenting ) के लिए comments का व्यापक रूप से उपयोग किया जाता है। Comments दो प्रकार के होते है।

  1. Single Line Comments
  2. Multi-Line Comments

Single Line Comments :  Single Line Comments को double slash ( // )दवारा represent करते है।

#include<stdio.h>    
int main(){      
    printf("Hello thetechnicalnotes");     //printing information  
return 0;  
}

Multi-Line Comments : Multi Line Comments को slash asterisk ( \* … *\ )दवारा represent करते है।

#include<stdio.h>    
int main(){    
    /*printing information   
      this is a simple program */  
    printf("Hello C");    
return 0;  
}

What is Format Specifier  in C in Hindi ?


Format specifier एक string है जिसका उपयोग formatted input और output functions के लिए किया जाता है। format specifier इनपुट और आउटपुट के format को निर्धारित करती है। format specifier हमेशा ‘%’ character से शुरू होती है।

format specifiers आमतौर पर printf () function मैं उपयोग किए जाते है।

Format specifier Description
%d or %i It is used to print the signed integer value where signed integer means that the variable can hold both positive and negative values.
%u It is used to print the unsigned integer value where the unsigned integer means that the variable can hold only positive value.
%o It is used to print the octal unsigned integer where octal integer value always starts with a 0 value.
%x It is used to print the hexadecimal unsigned integer where the hexadecimal integer value always starts with a 0x value. In this, alphabetical characters are printed in small letters such as a, b, c, etc.
%X It is used to print the hexadecimal unsigned integer, but %X prints the alphabetical characters in uppercase such as A, B, C, etc.
%f It is used for printing the decimal floating-point values. By default, it prints the 6 values after ‘.’.
%e/%E It is used for scientific notation. It is also known as Mantissa or Exponent.
%g It is used to print the decimal floating-point values, and it uses the fixed precision, i.e., the value after the decimal in input would be exactly the same as the value in the output.
%p It is used to print the address in a hexadecimal form.
%c It is used to print the unsigned character.
%s It is used to print the strings.
%ld It is used to print the long-signed integer value.

Example of some format specifier :

format specifier : %d 
int main()
{
int a = 25;
int b = 6;
printf("Value of a is:%d", a);
printf("\nValue of b is:%d", b);

return 0;
}  
output : 
Value of a is: 25
Value of b is: 6

format specifier : %o
int main()  
{  
  int a=0100;  
  printf("Octal value of a is: %o", a);  
  printf("\nInteger value of a is: %d",a);  
  return 0;  
}  

Output : 
Octal value of a is: 10
Integer value of a is: 64

 

What is Escape Sequence in C in Hindi ?


escape sequence , characters का sequence होता है। जो string literal और character के अंदर उपयोग किए जाने पर स्वयं को represent नहीं करता है।

यह backslash \ से शुरू होने वाले दो या दो से अधिक characters से बना है। उदाहरण के लिए \n नई लाइन का प्रतिनिधित्व करता है।

List of Escape Sequences in C :

Escape Sequence Meaning
  \a Alarm or Beep
  \b Backspace
  \f Form Feed
  \n New Line
  \r Carriage Return
  \t Tab (Horizontal)
  \v Vertical Tab
  \\ Backslash
  \’ Single Quote
  \” Double Quote
  \? Question Mark
  \nnn octal number
  \xhh hexadecimal number
  \0 Null

Example : 

#include<stdio.h>
int main(){
    printf("C \nlanguage\nis a\n\ progrraming language.");
return 0;
}

OUTPUT : 
C
language 
is a 
programming language

RECOMMENDED POST : 

  1. Introduction in C language in Hindi 
  2. Difference Between POP and OOP Language in Hindi ?
  3. printf () & scanf () Function in Hindi
  4. What is Variable in Hindi
  5. Keywords & Identifiers in C in Hindi