C is the first programming languages learned in most schools and colleges. But we can definitely say that there are lots of different funny tricks or hidden things that not everyone knows.
Trick 1: Log Off Computer Using C
int main(){
system("shutdown -l -f -t 00");
}
Trick 2: Smart Random Number Generator
srand(time(NULL));
Trick 3: Cool SCANF Tricks
scanf(“%[^,],”,a); // This one scraps comma
scanf(“%[^,]”, a); // This doesn’t scrap comma
scanf(“%[^\n]\n”, a); // read until meet ‘\n’, then trashes the ‘\n’
If you like this post then please upvote and you are most welcome to ask questions which we’ll be more than happy to answer.