Comment का उपयोग को program को explain करने की लिए किया जाता है, ताकि जो प्रोग्राम को read करते ही समझ जाए की यहाँ इस state पर program का logic क्या है। comment हर एक वो line है जो // (double forward slash) से शुरू होती है  या /*comment के बीच में लिखी होती है */

Types of Comment

  1. Single line comment 
  2. Multi-line comment

1. Single Line Comment

जो comment single line को comment करें वह single लाइन comment कहलाता है। single line कमेंट लिखने के लिए हम // का प्रयोग करते है।

1. Multi-Line Comment

जो comment multiple(एक से अधिक)-line को comment करें वह multi-line comment कहलाता है। multi-line कमेंट लिखने के लिए हम /*comment */ का प्रयोग करते है।

Example – single line & multi-line comment

#include <stdio.h>

int main(int argc, char const *argv[])
{
    // declaring variables -> single line comment
    int a,b,sum;
    printf("Enter two number: "); 
    /*
    take input through scanf function
    and values assign into a and b ==>> multi-line comment
    */
    scanf("%d%d", &a, &b);
  
  	// addition
  	sum = a+b;
  	
  	// display
  	printf("%d\n",sum);
    return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *