Gang's Tech Stuff

Posts Tagged ‘C/CPP

default case in switch – no error on spelling mistake

Posted by: Gangadhar on: December 17, 2008

The “default” case in a switch case need not be perfect by its spelling. If none of the cases satisfy the condition, the compiler will search for “default” case. If its there, it’ll execute that block. In case you have miss spelled it [may be in hurry! ], the compiler won’t give any error, but [...]

Standard Output in C

Posted by: Gangadhar on: December 17, 2008

“stdout” flushes the data to be printed to standard output device only after getting an new line character. If it wont get a new line character, it waits until the program ends, then it flushes the data. Ex: Code: #include<stdio.h> int main() {     fprintf(stdout,”hello-out1 \n”);     fprintf(stdout,”hello-out2 “);     fprintf(stderr,”hello-err “);     return 0; [...]


Follow

Get every new post delivered to your Inbox.