Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

write a c program to identify whether a given line is a comment or not.

0 votes
asked Jan 11, 2019 by Md Rukunuzzaman (120 points)
use for loop

1 Answer

0 votes
answered Jan 22, 2019 by Jyothi_Rk
#include <stdio.h>
#include <string.h>
#define max 100
void main ()
{
    int a,b;
    char arr[max];
    char dest[2];
    printf("Enter the line\n");
    scanf("%s",arr);
    strncpy(dest,arr,2);
    if ((a=strncmp(dest,"//",2))  && (b=strncmp(dest,"/*",2)))
        printf("not Comment\n");
    else
        printf("Comment\n");

}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...