Posts

Showing posts from March 7, 2011

Command Line Argument in C

#include int main(int argv,char *argc[]) { clrscr(); printf("%s",argc[1]); printf("\nNo. of arguments %d",argv); return 0; } Here argv - argument vector argc - argument character for execution compile the above program now it will generate an EXE file of that program now in turboc goto dos shell(File->Dos shell) type the name of the program and some argument Example: MyProgram Kunal The output will be Kunal No. of arguments : 2

Use printf without semicolon in simple C program

void main() { if(printf("Hi Kunal")){} } Since printf return non zero value thus this statement is always true