- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Comments in C/C++
Comments are the part of code which are ignored by the compiler. It makes the code easy to read and understand. Single and multi-line comments both work in the same way in C++ language.
Comments in C/C++
// Single Line Comment /* Multi Line Comments */
Here is an example of comments in C language,
Example
#include <stdio.h> #include <string.h> int main () { /* declarations of data members */ char s[10] = "HelloWorld"; char d[10]; int n; n = strxfrm(d, s, 5); printf("Length of string : %d", n); // length of string return(0); }
Output
Length of string : 10
In the above program, both comments single and multi-line are displayed. The program is copying the set of characters to the destination.
/* declarations of data members */ char s[10] = "HelloWorld"; char d[10]; int n; n = strxfrm(d, s, 5); printf("Length of string : %d", n); // length of string
Advertisements