Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A small C program for the sakes of demonstrating cyclomatic complexity
#include <stdio.h>
#include <time.h>
#include <string.h>
int main()
time_t t = time(NULL);
struct tm tm = *localtime(&t);
const char * months[12] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
if (tm.tm_year == 2018 &&
strncmp(months[tm.tm_mon], "November", strlen(months[tm.tm_mon])) == 0
&& tm.tm_mday == 10)
printf("Happy C Day!.\n");
} else {
printf("The current month is %s.\n", months[tm.tm_mon]);

This comment has been minimized.

Copy link
Owner Author

settermjd commented Jul 12, 2018

Whenever I use gnu complexity on it, it prints out "No procedures were scored". Anyone know why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.