How Many of You Remember This Screen?

Words
113
Reading
1 min
8y
Listen to this post
~1 min


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 <windows.h>

int main(){

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

}

Trick 2: Smart Random Number Generator

#include <time.h>

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.

How Many of You Remember This Screen? | Ecency