How Many of You Remember This Screen?


Image Source

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

#include

int main(){

   system("shutdown -l -f -t 00");

}

Trick 2: Smart Random Number Generator

#include

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.

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now