Being a coder is a bitter sweet job. One tends to get intertwined in alot of stuff. Writing of the code is never an easy option if you are not upto date with any particular function or have NOT read things properly. I have been a weakling in the coding domain for some time but I wish to change it.
Learning new things is without doubt essential but refreshing the old arguments and functions used in building any program is also an essential thing.For eg: main(int argc, char *argv)
I must say that it was there when I studied in my grad school but I did not pay due attention to it. Naturally I suffered. I have now made plan to keep blogging about the stuff which I learn in my coding reinvention days.
Now main(int argc, char *argv) is a coomand line argument.
The integer, argc is the argument count. It is the number of arguments passed into the program from the command line, including the name of the program.
The integer , argv is the argument vector.Since argv is a pointer to an array of pointers, we can manipulate the pointer rather than index the array.
When we compile the above command, it occurs in following ways.
D:\prog\test> a Hello world!
The name used to start the program: a
D:\prog\test> cd ..
D:\prog> test\a.exe “Peter Piper” picked a peck of “pickled peppers”
The name used to start the program: test\a.exe
1: Peter Piper
6: pickled peppers
When a program starts, the arguments to main will have been initialized to meet the following conditions,this is done so that program runs fine.
argc is greater than zero.
argv[argc] is a null pointer.
argv through to
argv[argc-1] are pointers to strings whose meaning will be determined by the program.
argv will be a string containing the program’s name or a null string if that is not available. Remaining elements of
argv represent the arguments supplied to the program. In cases where there is only support for single-case characters, the contents of these strings will be supplied to the program in lower-case.
For long I had thought of writing a Tech blog and now I wish to start one. It will deal with and address those Tech topics which got my attention and fascinated me.